Created
June 29, 2017 14:26
-
-
Save ernestofreyreg/1a7311a17bef0cb8d383fcc5d8afe728 to your computer and use it in GitHub Desktop.
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
const increaseFn = state => ({count: state.count + 1}) | |
class Counter extends React.Component { | |
state = { | |
count: 0 | |
} | |
increase = () => { | |
this.setState(increaseFn) | |
} | |
render () { | |
return <button onClick={this.increase}>{count}</button> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment