@fictjs/use-previous
v0.3.0
Published
Previous value accessor helper for Fict UI primitives.
Readme
@fictjs/use-previous
Previous-value accessor for Fict, modeled after @radix-ui/react-use-previous. Tracks the previous value of a reactive input across updates.
Part of ui-primitives, a port of Radix Primitives to Fict.
Installation
pnpm add @fictjs/use-previous fictUsage
import { usePrevious } from '@fictjs/use-previous'
const previousValue = usePrevious(() => value())
// previousValue() returns the value from before the latest changeAPI
usePrevious(value)— accepts a value or accessor and returns an accessor (() => T | undefined) for the value prior to the most recent change.
Exports
- Values:
usePrevious.
Documentation
The API mirrors @radix-ui/react-use-previous. See the ui-primitives overview and the architecture guide.
License
MIT © Fict contributors.
