SSR-safe layout effect for Fict, modeled after @radix-ui/react-use-layout-effect. Runs an effect after mount on the client and does nothing on the server, avoiding SSR warnings.
Part of ui-primitives, a port of Radix Primitives to Fict.
pnpm add @fictjs/use-layout-effect fictimport { useLayoutEffect } from '@fictjs/use-layout-effect'
useLayoutEffect(() => {
measure()
return () => cleanup()
})useLayoutEffect(effect)— on the client, runseffectafter mount inside a reactive effect (and honors its returned cleanup); on the server (nodocument), it is a no-op.
- Values:
useLayoutEffect.
The API mirrors @radix-ui/react-use-layout-effect. See the ui-primitives overview and the architecture guide.
MIT © Fict contributors.