@fictjs/use-effect-event
v0.3.0
Published
Stable event callback wrapper for Fict UI primitives.
Maintainers
Readme
@fictjs/use-effect-event
Stable event callback wrapper for Fict, modeled after @radix-ui/react-use-effect-event (React's useEffectEvent). Returns a function with a stable identity that always calls the latest callback — useful for event handlers referenced from effects.
Part of ui-primitives, a port of Radix Primitives to Fict.
Installation
pnpm add @fictjs/use-effect-event fictUsage
import { useEffectEvent } from '@fictjs/use-effect-event'
const onChange = useEffectEvent(props.onChange)
// `onChange` never changes identity, but always invokes the current props.onChangeAPI
useEffectEvent(callback)— returns a stable function that forwards to the most recentcallback(or is a no-op whencallbackis undefined).
Exports
- Values:
useEffectEvent.
Documentation
The API mirrors @radix-ui/react-use-effect-event. See the ui-primitives overview and the architecture guide.
License
MIT © Fict contributors.
