Created
December 1, 2018 01:14
-
-
Save Jahans3/1a1aa337c63fc288fda2231ce8baf1d0 to your computer and use it in GitHub Desktop.
Use state
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, { useState } from 'react'; | |
function Counter () { | |
const [count, setCount] = useState(0); | |
return ( | |
<> | |
<span> | |
Count: {count} | |
</span> | |
<button onClick={() => setCount(count + 1)}> | |
Increment | |
</button> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment