react-route-cache
Version:
keep-alive cache for react router
30 lines (29 loc) • 974 B
TypeScript
import React, { ReactNode, FC } from 'react';
import { TabsItem, CachesItem, LifeCircle } from '../types';
type LifeCircles = {
[key: string]: Array<LifeCircle>;
};
interface KeepAliveContext {
activateds: LifeCircles;
setActivateds?: (activateds: LifeCircles) => void;
deactivateds: LifeCircles;
setDeactivateds?: (deactivateds: LifeCircles) => void;
active?: string;
setActive?: (active: string) => void;
tabs?: TabsItem[];
setTabs?: (tabs: TabsItem[]) => void;
caches?: CachesItem[];
setCaches?: (caches: CachesItem[]) => void;
nameKey?: string;
cacheMaxRemove?: boolean;
}
declare const KeepAliveContext: React.Context<KeepAliveContext>;
interface KeepAliveScopeProps {
mode?: 'path' | 'search';
nameKey?: string;
cacheMaxRemove?: boolean;
children: ReactNode;
}
export declare const KeepAliveScope: FC<KeepAliveScopeProps>;
export declare const useKeepAliveContext: () => KeepAliveContext;
export {};