Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created May 1, 2019 21:59
Show Gist options
  • Save gpDA/c1db4f5680aeaa911d768cdd28b611d0 to your computer and use it in GitHub Desktop.
Save gpDA/c1db4f5680aeaa911d768cdd28b611d0 to your computer and use it in GitHub Desktop.
// ./components/ButtonElement/buttonHandler.js
render() {
return (
<div>
{/* show counter for each state change */}
<span>{this.count()}</span>
{/* increment button with value of counters `id` */}
<button className="buttonStyle" onClick={() => this.props.onIncrement(this.props.counter)}>line{this.props.counter.id}+</button>
{/* decrement button with value of counters `id` */}
<button className="buttonStyle" onClick={() =>this.props.onDecrement(this.props.counter)}>line{this.props.counter.id}-</button>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment