react-activation icon indicating copy to clipboard operation
react-activation copied to clipboard

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

Open killer-wu opened this issue 1 year ago • 0 comments

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

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

return ( <> <KeepAliveContainer name={location.pathname}> <Outlet /> </KeepAliveContainer> </> ); };

export default KeepAliveWrapper;

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

killer-wu avatar Dec 12 '23 08:12 killer-wu