Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ClickCounter = React.createClass({
- getInitialState: function() {
- return {clicked: 0};
- },
- click: function() {
- this.setState({clicked: this.state.clicked + 1});
- },
- render: function() {
- return (
- <button onClick={this.click}>
- Clicked: {this.state.clicked}
- </button>
- );
- }
- });
- ReactDOM.render(<ClickCounter />, document.getElementById("container"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement