Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ButtonIncrement extends React.Component {
state = { counter: 0 }
handleOnClick = () => {
this.setState((prevState) => ({
counter: prevState.counter + 1
}));
}
render() {
return (
<Button
onClick={this.handleOnClick}
buttonText={`Current counter: ${this.state.counter}`}
/>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment