Last active
January 9, 2021 00:21
-
-
Save tfiechowski/f0403d045a659c8a13a2f6bb74c7dbc7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { useState } from "react"; | |
export function FunctionalUpdates() { | |
const [counter, setCounter] = useState(0); | |
function handleIncrement() { | |
setCounter(counter + 1); | |
} | |
return ( | |
<div> | |
<div>Counter value: {counter}</div> | |
<button onClick={handleIncrement}> | |
Increment | |
</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment