CJY0208 / react-activation

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

vite环境本地运行可以,打包环境报 useLocation() may be used only in the context of a <Router> component. #264

Closed lin593 closed 1 year ago

lin593 commented 1 year ago

场景:跳转到含缓存的页面,页面是用标签内嵌的组件,会出错 import Activation,{ useActivate , useAliveController } from 'react-activation' return (

) vite.config.ts 已用 reactNodeKey()

CJY0208 commented 1 year ago

将 AliveScope 放在路由的 Router 内部试试

lin593 commented 1 year ago
截屏2023-03-28 18 13 31
lin593 commented 1 year ago

已经解决