Created
June 30, 2020 11:24
-
-
Save alexmochu/c719b2eb47d808edaea7cdb29c9e1b2f to your computer and use it in GitHub Desktop.
Counter Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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