Last active
April 13, 2019 09:47
-
-
Save ohansemmanuel/6e14372f4e2e458031eecb66e4688473 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
// 🐢 setState (object merge) vs useState (object replace) | |
// assume initial state is {name: "Ohans"} | |
setState({ age: 'unknown' }) | |
// new state object will be | |
// {name: "Ohans", age: "unknown"} | |
useStateUpdater({ age: 'unknown' }) | |
// new state object will be | |
// {age: "unknown"} - initial object is replaced |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment