component remounts when state is changed in context
Describe the bug
Component is remounted when reading state that is changed for the first time in the context on the first page load.
Your Example Website or App
https://stackblitz.com/edit/vitejs-vite-z6bowx
Steps to Reproduce the Bug or Issue
On first page load click the button to increment the counter. Open console to see that component is remounted. (printed from useEffect) Every next time the button is clicked component does not get remounted. To observe issue again reload the page.
Expected behavior
Component should not remount.
Screenshots or Videos
No response
Platform
macOS, Safari and Chrome (126.0.6478.61)
Additional context
No response
Why would the component not be remounted here?
The state has changed in-between the router instantiation and rendering. The component rerendering should be expected I think.
Thoughts @schiller-manuel
remounting does not happen anymore, tested with v1.52.1
https://stackblitz.com/edit/vitejs-vite-4bcuqe?file=package.json