useIsMounted
A hook for checking if the component is mounted.
A hook for checking if the component is mounted.
import { useIsMounted } from "@/hooks/useIsMounted";
const isMounted = useIsMounted();
// Use to prevent hydration errors
if (!isMounted) {
return <div>Loading...</div>;
}
return <ClientOnlyComponent />;