Created
October 29, 2017 12:18
-
-
Save YoneMoreno/66a1303fa918fd6491c2ff18c94cbb12 to your computer and use it in GitHub Desktop.
Samerbuna Learning React Clip First Component
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 Button extends React.Component { | |
| state = {counter: 0}; | |
| handleClick = () => { | |
| this.setState((prevState) => ({ | |
| counter: prevState.counter + 1 | |
| })); | |
| }; | |
| render(){ | |
| return ( | |
| <button onClick={this.handleClick}>{this.state.counter}</button> | |
| ); | |
| } | |
| } | |
| ReactDOM.render(<Button/>,mountNode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment