Created
October 18, 2017 15:55
-
-
Save ruffle1986/d7c8d64c5ea977ff412ec89fef2fc099 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
class MyComponent extends React.Component { | |
state = { | |
data: 0 | |
} | |
handleClick() { | |
const data = this.state.data; | |
this.setState({ | |
data: data + 1 | |
}); | |
} | |
render() { | |
return ( | |
<button onClick={ this.handleClick }>Click me!</button> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment