CJY0208 / react-activation

Hack <KeepAlive /> for React
https://www.npmjs.com/package/react-activation
MIT License
1.79k stars 141 forks source link

react-router v6 - TypeError: Cannot read properties of null (reading 'ctx') #247

Open whq920729 opened 1 year ago

whq920729 commented 1 year ago

"react": "16.14.0", "react-router": "^6.4.0", "react-router-dom": "^6.4.0", "react-activation": "^0.12.2" 使用 useOutlet,参照以往react-router v6 issue 只使用 keepAlive 没缓存效果,加上 AliveScope 就报这个 ctx 错误,刚使用react不久,麻烦大佬指点一下,万分感谢! 我有看到文档中有写 “Note: When used with react-router or react-redux, you need to place inside or ” 具体应该放哪里? 3 4 1 2

CJY0208 commented 1 year ago

App 的最外层有放置 react-router 的 Router 吗

whq920729 commented 1 year ago

感谢大佬回复!最外层是指?路由是使用的 createHashRouter,我想的是现在ctx有问题,是不是渲染时机问题?