Adding more to it. Components were always rendered twice(in some cases) in previous versions of Strict mode as well can check this thread github.com/facebook/react/issues/1... . So whats the difference now?
When a component is rendered the states that are created in previous render are destroyed and new references to newly created state variables are used in the second render.
While when simulating a re-render after simulating no new state is created and older state is used so if we made some changes to state in useEffect those changes will reflect and will be used as initial state of "simulated re-render". This is the main difference now.
Please do not confuse between two different things.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Adding more to it. Components were always rendered twice(in some cases) in previous versions of Strict mode as well can check this thread github.com/facebook/react/issues/1... . So whats the difference now?
When a component is rendered the states that are created in previous render are destroyed and new references to newly created state variables are used in the second render.
While when simulating a re-render after simulating no new state is created and older state is used so if we made some changes to state in useEffect those changes will reflect and will be used as initial state of "simulated re-render". This is the main difference now.
Please do not confuse between two different things.