Created
September 29, 2023 01:48
-
-
Save masious/88ed66eaf462296ce19dc84acebecec6 to your computer and use it in GitHub Desktop.
example of an un-memoized callback
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
function MyHeavyComponent() { | |
const [counter, setCounter] = useState(0); | |
return ( | |
<button onClick={() => setCounter(counter + 1)}>Hit me</button> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment