← SnippetsuseMountedAvoid weird SSR issues whether you're rendering on the client or serverSep 11, 2022 · 1 min readexport const useMounted = () => { const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); return mounted; }; Usage const SomeClientSideOnlyComponent = () => { const mounted = useMounted(); if (!mounted) { return null; } return <div>This is client only!</div>; };