Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created May 1, 2019 21:53
Show Gist options
  • Save gpDA/f1b95d185de721e83b60a66fba84b69d to your computer and use it in GitHub Desktop.
Save gpDA/f1b95d185de721e83b60a66fba84b69d to your computer and use it in GitHub Desktop.
// ./components/ButtonElement/counter.js
class Counters extends Component{
render(){
return (
<div>
{/* map will run 3 times and
make 3 ButtonHandlers */}
{this.props.counters.map(counter => (
<ButtonHandler
key={counter.id}
onIncrement={this.props.onIncrement}
onDecrement={this.props.onDecrement}
counter={counter}
/>
))}
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment