You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of them render component (RootPageComponent) which is a PureComponent and is rendered using render prop in order to not re-render on page change. This component has a table inside (RootPageComponentTable).
Open console, go from route to route - you will see that both RootPageComponent and RootPageComponentTable render only once and don't re-render on route change.
Now open example [2]
The only difference is that Link component is added to RootPageComponentTable. Open console, go from route to route - you will see RootPageComponentTable is re-rendered on route change.
This doesn't happen if you:
use react-router 4.3.1 (example [3]) or
remove redux Provider usage (example [4]) or
wrap router with redux Provider which is not always possible (example [5])
Expected Behavior
Pure component doesn't re-render contents on every route change when used with render prop and Link component inside, redux Provider is used inside router.
Actual Behavior
Pure component re-renders contents on every route change when Link component is used inside, redux Provider is used inside router.
Since array path support is also added in this version, this is also related to it and needs some kind of solution or fix.
The text was updated successfully, but these errors were encountered:
Version
4.4.0-beta.4
Test Case
[1] https://codesandbox.io/s/10kmz6x1q7 [doesn't show bug]
[2] https://codesandbox.io/s/245wk2xwpp [shows bug]
[3] https://codesandbox.io/s/k32w3w0mo3 [no bug in 4.3.1]
[4] https://codesandbox.io/s/6z6l4779n [no bug when no redux]
[5] https://codesandbox.io/s/5xrnv12rpx [no bug when redux wraps router]
Steps to reproduce
Open example [1]
In the example there are 3 routes:
/
,/one
,/two
.All of them render component (
RootPageComponent
) which is aPureComponent
and is rendered usingrender
prop in order to not re-render on page change. This component has a table inside (RootPageComponentTable
).Open console, go from route to route - you will see that both
RootPageComponent
andRootPageComponentTable
render only once and don't re-render on route change.Now open example [2]
The only difference is that
Link
component is added toRootPageComponentTable
. Open console, go from route to route - you will seeRootPageComponentTable
is re-rendered on route change.This doesn't happen if you:
Provider
usage (example [4]) orProvider
which is not always possible (example [5])Expected Behavior
Pure component doesn't re-render contents on every route change when used with
render
prop andLink
component inside, reduxProvider
is used inside router.Actual Behavior
Pure component re-renders contents on every route change when
Link
component is used inside, reduxProvider
is used inside router.Since array path support is also added in this version, this is also related to it and needs some kind of solution or fix.
The text was updated successfully, but these errors were encountered: