maybe some of you can open my eyes.
I don\'t understand why in this code: https://codesandbox.io/s/use-state-renders-twice-6r1xl component App renders twice when mounte
It is because of React.StrictMode
and this only happens in development. If you remove React.StrictMode you will get only 1 log.
For more details, check this thread on react repo:
https://github.com/facebook/react/issues/15074
Also check React docs: https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects
Check the app without StrictMode here: https://codesandbox.io/s/use-state-renders-twice-3vroc
Hope this helps!