Commit ef1b5ca1 authored by Martin Wighus Holtmon's avatar Martin Wighus Holtmon
Browse files

projectFirstPart/Problem4 - Removed boud function

parent c9c02efd
......@@ -7,12 +7,10 @@ import Header from "./components/header/Header";
class P4 extends React.Component {
constructor(props) {
super(props);
this.handleButtonClick = this.handleButtonClick.bind(this);
this.state = {activePage: States, nextPage: Example}
console.log(this.state.activePage.name)
}
handleButtonClick() {
handleButtonClick = () => {
this.setState({activePage: this.state.nextPage, nextPage: this.state.activePage})
}
......@@ -21,7 +19,7 @@ class P4 extends React.Component {
<div>
<Header />
<button type="button" onClick={this.handleButtonClick}>Switch to {this.state.nextPage.name}</button>
<this.state.activePage/>
<this.state.activePage />
</div>
)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment