@fictjs/use-layout-effect
v0.3.0
Published
Layout-effect shim for Fict UI primitives.
Maintainers
Readme
@fictjs/use-layout-effect
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.
Installation
pnpm add @fictjs/use-layout-effect fictUsage
import { useLayoutEffect } from '@fictjs/use-layout-effect'
useLayoutEffect(() => {
measure()
return () => cleanup()
})API
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.
Exports
- Values:
useLayoutEffect.
Documentation
The API mirrors @radix-ui/react-use-layout-effect. See the ui-primitives overview and the architecture guide.
License
MIT © Fict contributors.
