-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render prop remounts the component on every route change #5972
Comments
You need to wrap your |
@pshrmn Thank you Paul. But then there is still this issue: https://codesandbox.io/s/ywzll8wn8j As soon as I map the routes from an array and i add a |
That is just how React's reconciliation works. React compares an element's If #5889 gets merged, you will be able to group multiple paths under the same |
But the key does not change in this example, no? |
Scratch that. I misunderstood. Makes perfect sense. Thank you Paul, sorry for the useless bug report. |
Version
4.2.0
Test Case
https://codesandbox.io/s/j2p1r0kvx5
Expected Behavior
According to the documentation here: https://reacttraining.com/react-router/web/api/Route/render-func the inline render with a render prop should not remount the component every time.
Actual Behavior
You can see from the console logs that the Test component is unmounted and mounted again for every route change.
I have been trying to find a reason for this since yesterday. But even in the simplest test case this still happens. Please excuse my lack of knowledge, if this is not a bug, please explain what is happening.
The text was updated successfully, but these errors were encountered: