My initial state depends on pathname. I receive pathname with hook useRouter. Can I use received pathname to initialize state in useState?
const { pathname } = useRouter();
const [isOpen, setIsOpen] = useState(() => isMyPathname(pathname));
It works, but I didn't find such examples. So I'm not sure it's correct.