React Quiz on how useState works 1/2
https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚛️" title="Atom-Symbol" aria-label="Emoji: Atom-Symbol">
Q: If we call the `increment` function once, what will be the value of `counter` in the next render?
Choose your answer using the poll in the thread!
#reactjs #CodeNewbie #100DaysOfCode #javascript #CodeNewbies
...
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🧵" title="Thread" aria-label="Emoji: Thread">
Q: If we call the `increment` function once, what will be the value of `counter` in the next render?
Choose your answer using the poll in the thread!
#reactjs #CodeNewbie #100DaysOfCode #javascript #CodeNewbies
...
The answer can be found in this CodeSandbox
https://abs.twimg.com/emoji/v2/... draggable="false" alt="👉" title="Rückhand Zeigefinger nach rechts" aria-label="Emoji: Rückhand Zeigefinger nach rechts"> https://codesandbox.io/s/counter-1-gjvzt?file=/src/App.js
But">https://codesandbox.io/s/counter... wait, don& #39;t leave, there& #39;s still another question
https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">
But">https://codesandbox.io/s/counter... wait, don& #39;t leave, there& #39;s still another question
React Quiz on how useState works 2/2
https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚛️" title="Atom-Symbol" aria-label="Emoji: Atom-Symbol">
Same question but different code! What will happen now?
Q: If we call the `increment` function once, what will be the value of `counter` in the next render?
Same question but different code! What will happen now?
Q: If we call the `increment` function once, what will be the value of `counter` in the next render?
The answer can be found in this CodeSandbox
https://abs.twimg.com/emoji/v2/... draggable="false" alt="👉" title="Rückhand Zeigefinger nach rechts" aria-label="Emoji: Rückhand Zeigefinger nach rechts"> https://codesandbox.io/s/counter-2-5spji?file=/src/App.js
...">https://codesandbox.io/s/counter...
...">https://codesandbox.io/s/counter...
If you don& #39;t understand what& #39;s going on it& #39;s probably because you just need to learn how `useState` works, and for that I& #39;m going to recommend you this article:
https://abs.twimg.com/emoji/v2/... draggable="false" alt="👉" title="Rückhand Zeigefinger nach rechts" aria-label="Emoji: Rückhand Zeigefinger nach rechts"> https://kentcdodds.com/blog/use-state-lazy-initialization-and-function-updates">https://kentcdodds.com/blog/use-...
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✍️" title="Schreibende Hand" aria-label="Emoji: Schreibende Hand"> By @kentcdodds
Hope you liked it!
Follow me if you want to learn more about React, JavaScript or the web in general
https://abs.twimg.com/emoji/v2/... draggable="false" alt="😊" title="Lächelndes Gesicht mit lächelnden Augen" aria-label="Emoji: Lächelndes Gesicht mit lächelnden Augen">
Follow me if you want to learn more about React, JavaScript or the web in general
You may also want to check out this schema to see what& #39;s going on with these setCounter calls
https://abs.twimg.com/emoji/v2/... draggable="false" alt="😉" title="Zwinkerndes Gesicht" aria-label="Emoji: Zwinkerndes Gesicht">
Built with @excalidraw
Built with @excalidraw