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 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!
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?