Why React Hook useState uses const and not let?

Posted by Rohit Kumar | Updated on

In this example, I have shared why React Hook useState uses const and not let? Not really. When the component is rerendered, the function is executed again, creating a new scope, creating a new count variable, which has nothing to do with the previous variable.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers