Last active
January 5, 2022 08:49
-
-
Save dance2die/35416648292313d931c7bd6efb930fb8 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
function App() { | |
const [count, setCount] = useState(0); | |
const [message, setMessage] = useState(""); | |
function increment() { | |
setCount(count + 1); | |
setMessage(`count is ${count}`); | |
} | |
function decrement() { | |
setCount(count - 1); | |
setMessage(`count is ${count}`); | |
} | |
return ( | |
<div className="App"> | |
... | |
</div> | |
); | |
} |
Thank you, @tfiechowski for the correction~
I don't have an excuse as I misunderstood Dan's suggestion π
I've updated the post and added your gist π
Sure, no worries!
I'm happy I could contribute and also big appreciation for a mention in the article! π
β high-five for the contribution~
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! I encountered this article and started to wonder why haven't you followed Dan's suggestion to calculate next value and update both:
What's the reason for not doing so?