Async function client side
Unanswered
Griffon Bleu de Gascogne posted this in #help-forum
Griffon Bleu de GascogneOP
Hello, Im building an app and i have to create a navbar with NextUI and NextAuth and i want to get my session but I have to be client side because im using "useState" but i got an error everytime i refresh the page
1 Reply
Griffon Bleu de GascogneOP
'use client';
import { useState } from 'react';
...
export const NavigationBar = async () => {
const session = await getServerSession(authOptions);
const [isMenuOpen, setIsMenuOpen] = useState(false);
const menuItems = [
'Profile',
'Dashboard',
'Activity',
'Analytics',
'System',
'Deployments',
'My Settings',
'Team Settings',
'Help & Feedback',
'Log Out',
];
return (
...
);
};