Компонент:
Код: Выделить всё
import CloseButton from "./CloseButton"
import { useEffect, useState } from "react"
export const NavBar = ({ state, setStateFunction }: { state: boolean, setStateFunction: (value: boolean) => void }) => {
useEffect(() => {
console.log(state);
}, [state]);
return (
{setStateFunction(false)}}>
[list]
[*][url=/auth/login]
{/* */}
[/url]
{/* */}
)
}
Код: Выделить всё
import { Inter } from "next/font/google";
import { NavBar } from "./components/NavBar";
import { useState } from "react";
const inter = Inter({ subsets: ["latin"] });
export default function Home() {
const [asideBar, setAsideBar] = useState(false);
return (
setAsideBar(true)} className="mr-4">
Open the sidebar
setAsideBar(false)} className="mr-4">
close sidebar
{asideBar && }
);
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... on-my-menu