Skip to content

Instantly share code, notes, and snippets.

@alexmochu
Created June 30, 2020 11:24
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 alexmochu/c719b2eb47d808edaea7cdb29c9e1b2f to your computer and use it in GitHub Desktop.
Save alexmochu/c719b2eb47d808edaea7cdb29c9e1b2f to your computer and use it in GitHub Desktop.
Counter Component
import React from 'react';
import './App.css';
const Counter = ({ value, onIncrement, onDecrement, onIncrementAsync }) =>
<div>
<button onClick={onIncrementAsync} className="button">
Increment after 1 second
</button>
{' '}
<button onClick={onIncrement} className="button">
+ Increment
</button>
{' '}
<button onClick={onDecrement} className="button">
- Decrement
</button>
<hr />
<div>
Clicked: {value} times
</div>
</div>
export default Counter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment