Skip to content

Instantly share code, notes, and snippets.

@Salman18
Created October 24, 2017 08:31
Show Gist options
  • Save Salman18/03db1976120687d408105ef07c8b57ee to your computer and use it in GitHub Desktop.
Save Salman18/03db1976120687d408105ef07c8b57ee to your computer and use it in GitHub Desktop.
Button 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);
@Salman18
Copy link
Author

React JS File.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment