diff --git a/frontend/bun.lockb b/frontend/bun.lockb index 5adf760..0878d98 100755 Binary files a/frontend/bun.lockb and b/frontend/bun.lockb differ diff --git a/frontend/package.json b/frontend/package.json index 8e3b0d7..f1098f5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,7 @@ "@radix-ui/react-slot": "^1.1.0", "@react-email/components": "^0.0.22", "@react-email/tailwind": "^0.0.19", + "@reduxjs/toolkit": "^2.3.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "dotenv": "^16.4.5", @@ -25,6 +26,8 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-icons": "^5.3.0", + "react-redux": "^9.1.2", + "redux": "^5.0.1", "resend": "^3.5.0", "sass": "^1.80.5", "sharp": "^0.33.5", diff --git a/frontend/src/app/StoreProvider.tsx b/frontend/src/app/StoreProvider.tsx new file mode 100644 index 0000000..13ccb28 --- /dev/null +++ b/frontend/src/app/StoreProvider.tsx @@ -0,0 +1,18 @@ +'use client' +import { useRef } from 'react' +import { Provider } from 'react-redux' +import { makeStore, AppStore } from '../lib/Store' + +export default function StoreProvider({ + children +}: { + children: React.ReactNode +}) { + const storeRef = useRef() + if (!storeRef.current) { + // Create the store instance the first time this renders + storeRef.current = makeStore() + } + + return {children} +} \ No newline at end of file diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 9d98d4c..d03158b 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -3,6 +3,7 @@ import { Inter } from "next/font/google"; import "./globals.css"; import Navbar from "@/components/Navbar/Navbar"; import Footer from "@/components/Footer/Footer"; +import StoreProvider from "./StoreProvider"; const inter = Inter({ subsets: ["latin"] }); @@ -18,12 +19,14 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - - - - {children} -