StructureBuilder / react-keep-alive

A component that maintains component state and avoids repeated re-rendering.
MIT License
981 stars 105 forks source link

`KeepAlive`由于使用`PureCompoennt`实现会影响子组件正常渲染 #100

Open qiqiboy opened 3 years ago

qiqiboy commented 3 years ago

复现示例

https://codesandbox.io/s/with-react-router-forked-uy566

One 这个路由下,点击 add num 按钮,无法将父级的状态传递到KeepAlive下层的组件上,因为对于KeepAlive组件来说它本身的props并没有发生改变,所以基于PureComponent的实现导致其阻止了它下层组件的渲染。