Open qiqiboy opened 3 years ago
https://codesandbox.io/s/with-react-router-forked-uy566
在 One 这个路由下,点击 add num 按钮,无法将父级的状态传递到KeepAlive下层的组件上,因为对于KeepAlive组件来说它本身的props并没有发生改变,所以基于PureComponent的实现导致其阻止了它下层组件的渲染。
One
add num
KeepAlive
PureComponent
复现示例
https://codesandbox.io/s/with-react-router-forked-uy566
在
One
这个路由下,点击add num
按钮,无法将父级的状态传递到KeepAlive
下层的组件上,因为对于KeepAlive
组件来说它本身的props并没有发生改变,所以基于PureComponent
的实现导致其阻止了它下层组件的渲染。