-
-
Save gil00pita/ae985cbf3c70097f51840e99c918d777 to your computer and use it in GitHub Desktop.
https://levelup.gitconnected.com/9-tricks-for-kickass-javascript-developers-in-2019-eb01dd3def2a ### Class properties & binding Binding functions in JavaScript is a common task. With the introduction of arrow functions in the ES6 spec, we now have
This file contains 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 Counter extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { count: 0 } | |
} | |
render() { | |
return( | |
<div> | |
<h1>{this.state.count}</h1> | |
<button onClick={this._increaseCount}>Increase Count</button> | |
</div> | |
) | |
} | |
_increaseCount = () => { | |
this.setState({ count: this.state.count + 1 }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment