useIsClient

import { useEffect, useState } from "react";
export function useIsClient(): boolean {
const [isClient, setIsClient] = useState(false);
useEffect(() => {
setIsClient(true);
}, []);
return isClient;
}

The useIsClient hook is a simple React hook that returns true only after the component has mounted on the client side. This is useful for distinguishing between server-side and client-side rendering, such as when you need to access browser-specific APIs or avoid hydration mismatches in Next.js or other SSR frameworks.