Created
November 5, 2019 17:45
-
-
Save sabesansathananthan/54e689666ab7178555ed4fe1eb540d86 to your computer and use it in GitHub Desktop.
example 1 for react best practice to handle this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo extends Components { | |
constructor(props) { | |
super(props); | |
this.state = { message: "Hello" }; | |
} | |
logMessage() { | |
const { message } = this.state; | |
console.log(message); | |
} | |
render() { | |
return ( | |
<input type="button" value="Log" onClick={this.logMessage.bind(this)} /> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment