Skip to content

Instantly share code, notes, and snippets.

@Siemko
Last active November 6, 2017 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Siemko/b9acdced11ce23b9b6dc9fff10da0aae to your computer and use it in GitHub Desktop.
Save Siemko/b9acdced11ce23b9b6dc9fff10da0aae to your computer and use it in GitHub Desktop.
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