Skip to content

Instantly share code, notes, and snippets.

@DZuz14
Created September 9, 2017 13:09
Show Gist options
  • Save DZuz14/8a382c47f8c845b57a15ce0e7ea5e2f3 to your computer and use it in GitHub Desktop.
Save DZuz14/8a382c47f8c845b57a15ce0e7ea5e2f3 to your computer and use it in GitHub Desktop.
Controls
/**
* Displays count and houses the increment and decrement buttons
*/
const Controls = ({ id, increment, decrement, count }) => {
return (
<div className="controls">
<div data-id={id} className="minus" onClick={e => decrement(e.target.getAttribute("data-id"))}>
-
</div>
<div className="counter">
{count}
</div>
<div data-id={id} className="plus" onClick={e => increment(e.target.getAttribute("data-id")) }>
+
</div>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment