Advertisement
arxeiss

Example React

May 19th, 2016
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ClickCounter = React.createClass({
  2.     getInitialState: function() {
  3.         return {clicked: 0};
  4.     },
  5.     click: function() {
  6.         this.setState({clicked: this.state.clicked + 1});
  7.     },
  8.     render: function() {
  9.         return (
  10.             <button onClick={this.click}>
  11.                 Clicked: {this.state.clicked}
  12.             </button>
  13.             );
  14.         }
  15.     });
  16.  
  17. ReactDOM.render(<ClickCounter />, document.getElementById("container"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement