Loading...
Loading...
Loading...
SSR-safe useLayoutEffect — uses useEffect on the server, useLayoutEffect on the client.
Install
npx bouncekit@latest add useisomorphiclayouteffectImport
import { useIsomorphicLayoutEffect } from "@/hooks/use-isomorphic-layout-effect.ts"import { useIsomorphicLayoutEffect } from "@/hooks/use-isomorphic-layout-effect"
// SSR-safe useLayoutEffect.
// Uses useEffect on server, useLayoutEffect on client.
useIsomorphicLayoutEffect(() => {
// Measure DOM, set up subscriptions
}, [deps])API Reference
Extends native HTML attributes — no custom props.
Source
src/hooks/use-isomorphic-layout-effect.ts