Skip to content

Latest commit

 

History

History

use-layout-effect

Folders and files

README.md

@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 fict

Usage

import { useLayoutEffect } from '@fictjs/use-layout-effect'

useLayoutEffect(() => {
  measure()
  return () => cleanup()
})

API

  • useLayoutEffect(effect) — on the client, runs effect after mount inside a reactive effect (and honors its returned cleanup); on the server (no document), 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.