CJY0208 / react-activation

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

vite+react router v6 Layout路由问题 #308

Closed caicai1998 closed 4 months ago

caicai1998 commented 6 months ago

image 在layout中用KeepAlive包裹Outlet,缓存生效。 image 我现在想把KeepAlive下放到layout中某个子页面为什么缓存就失效了啊?

CJY0208 commented 4 months ago

KeepAlive 保护的是整个组件不被卸载,你图二中的 first 来源于 KeepAlive 外部,不会收到缓存保护,如果想要实现这个功能,需要 KeepAlive 包裹整个 PageHome