seedling/source/ui/src/providers/Redux.tsx

17 lines
431 B
TypeScript
Raw Normal View History

2023-12-28 21:58:08 +00:00
// @ts-nocheck
'use client';
import { useRef, ReactNode } from 'react';
import { Provider } from 'react-redux';
import { makeStore } from '../redux/store';
export function ReduxProvider({ children }: { children: ReactNode }) {
const storeRef = useRef<ReturnType<typeof makeStore> | null>(null);
if (!storeRef.current) {
storeRef.current = makeStore();
}
return <Provider store={storeRef.current}>{children}</Provider>;
}