react-keepalive-router
react-keepalive-router copied to clipboard
The react cache component developed based on react 16.8 +, react router 4 + can be used to cache page components, similar to Vue keepalive package Vue router effect function.(基于react 16.8+ ,react-ro...
路由传参有问题,页面滚动也有问题。
route设置scroll属性,但是监听不到parentNode的滚动,还要设置什么嘛
index.js:905 Uncaught TypeError: Cannot read properties of undefined (reading 'state') at CacheRoute.UNSAFE_componentWillReceiveProps (index.js:905:1) at callComponentWillReceiveProps (react-dom.development.js:13607:16) at updateClassInstance (react-dom.development.js:13844:9) at updateClassComponent (react-dom.development.js:20440:22) at beginWork (react-dom.development.js:22376:18) at HTMLUnknownElement.callCallback (react-dom.development.js:4144:16) at Object.invokeGuardedCallbackDev...
作者有空看一下 页面一刷新就报错了 demo : [dist.zip](https://github.com/GoodLuckAlien/react-keepalive-router/files/8867869/dist.zip)
把route路由更换为KeepaliveRoute之后,exact属性无效。比如列表页的路由:/video/study,详情页的路由:/video/study/list,这样从列表点击跳转到详情的时候,地址栏的路由发生了变化,但是页面并没有跳到详情页去
router ``` js ``` 使用 ``` js import { useParams } from 'react-router-dom'; const { id } = useParams(); // ?undefined ```