Skip to content

Instantly share code, notes, and snippets.

@pivcec
Created September 25, 2024 01:03
Show Gist options
  • Save pivcec/c481146cdf5acc7081cdd5df5d3e275b to your computer and use it in GitHub Desktop.
Save pivcec/c481146cdf5acc7081cdd5df5d3e275b to your computer and use it in GitHub Desktop.
"use client"; // This directive makes the component a client component
import { createPagesBrowserClient } from "@supabase/auth-helpers-nextjs";
import { SessionContextProvider } from "@supabase/auth-helpers-react";
import TopNav from "../components/TopNav"; // Import the navigation component
import { useState, ReactNode } from "react";
export const dynamic = "force-dynamic";
// Define props type
interface RootLayoutProps {
children: ReactNode; // children can be any valid React node
}
export default function RootLayout({ children }: RootLayoutProps) {
const [supabaseClient] = useState(() => createPagesBrowserClient());
return (
<SessionContextProvider supabaseClient={supabaseClient}>
<html lang="en">
<body>
<TopNav />
{children}
</body>
</html>
</SessionContextProvider>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment