Amandeep Singh
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

--

--

Amandeep Singh
Amandeep Singh

Written by Amandeep Singh

Developer @ Domain Sydney. Tech enthusiast and a pragmatic programmer. If coding is hard, you are not doing it right.

No responses yet