1 min readSep 2, 2020
Hi Erik,
Glad that you liked the article.
Referring to your question, here we are using updater function approach. This function gets the previous state as its argument, and whatever you return becomes the new computed state. Interestingly, React manages this for you.
You can read more about it here: https://reactjs.org/docs/hooks-reference.html#functional-updates