first commit
This commit is contained in:
commit
86ffedffca
24 files changed
+8576
No files matched your search
@@ -0,0 +1,18 @@
|
||||
"use client";
|
||||
import { useRef } from "react";
|
||||
import { Provider } from "react-redux";
|
||||
import { makeStore, AppStore } from "../lib/store";
|
||||
|
||||
import React from "react";
|
||||
|
||||
const BookProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const storeRef = useRef<AppStore>(undefined);
|
||||
if (!storeRef.current) {
|
||||
// Create the store instance the first time this renders
|
||||
storeRef.current = makeStore();
|
||||
}
|
||||
|
||||
return <Provider store={storeRef.current}>{children}</Provider>;
|
||||
};
|
||||
|
||||
export default BookProvider;
|
||||
Reference in new issue
Block a user