-
-
Save HuyAms/0a66178ed30c408f867ab1c4b0c14aa7 to your computer and use it in GitHub Desktop.
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
const App = () => { | |
const [count1, setCount1] = React.useState(0) | |
const [count2, setCount2] = React.useState(0) | |
const increaseCounter1 = () => { | |
setCount1(count1 => count1 + 1) | |
} | |
const increaseCounter2 = () => { | |
setCount1(count2 => count1 + 1) | |
} | |
return ( | |
<> | |
<Counter value={count1} onClick={increaseCounter1}>Counter 1</Counter> | |
<Counter value={count2} onClick={increaseCounter2}>Coutner 2</Counter> | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment