CJY0208 / react-activation

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

在umi4中 使用 使用wrappers布局 缓存组件使用outlet 无法正常缓存,通过 getCachingNodes 只能获取一个节点 #302

Open killer-wu opened 8 months ago

killer-wu commented 8 months ago

import { KeepAliveContainer } from '@/components/KeepAliveWrapper'; import { Outlet, useLocation } from '@umijs/max'; import { FC } from 'react';

const KeepAliveWrapper: FC = () => { const location = useLocation();

return ( <> \ \<Outlet /> \</KeepAliveContainer> \<\/> ); };

export default KeepAliveWrapper;

export const KeepAliveContainer = (props: any) => { return ( \<> \{props.children}\</KeepAlive> \<\/> ); };