+ {props.children}
+ {Object?.values(keepAliveStates).map((state) => {
+ const { keepAliveId, reactElement } = state;
+ return (
+ {
+ if (node && !keepAliveStates[keepAliveId]?.nodes) {
+ dispatch({
+ type: actionTypes.CREATED,
+ payload: {
+ keepAliveId,
+ nodes: Array.from(node.childNodes) as any[],
+ },
+ });
+ }
+ }}
+ >
+ {reactElement}
+
+ );
+ })}
+
+ );
+};
+
+export default KeepAlive;
diff --git a/src/core/base/KeepAlive/KeepAliveContext.tsx b/src/core/base/KeepAlive/KeepAliveContext.tsx
new file mode 100644
index 0000000..6d1c5a8
--- /dev/null
+++ b/src/core/base/KeepAlive/KeepAliveContext.tsx
@@ -0,0 +1,11 @@
+import { createContext } from 'react';
+import { ISetKeepAliveState } from './KeepAlive';
+import { KeepAliveActions, KeepAliveState } from './KeepAliveReducer';
+
+export interface IKeepAliveContext {
+ keepAliveStates: KeepAliveState;
+ setKeepAliveState: ISetKeepAliveState;
+ dispatch: React.Dispatch