Skip to content

Instantly share code, notes, and snippets.

@YoneMoreno
Created October 29, 2017 12:18
Show Gist options
  • Select an option

  • Save YoneMoreno/66a1303fa918fd6491c2ff18c94cbb12 to your computer and use it in GitHub Desktop.

Select an option

Save YoneMoreno/66a1303fa918fd6491c2ff18c94cbb12 to your computer and use it in GitHub Desktop.
Samerbuna Learning React Clip First Component
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