useInitialValue
Captures and returns the initial value of a prop, ignoring subsequent changes.
Captures and preserves the value from the initial render, ignoring all subsequent changes. Useful when you need to reference a prop's original value throughout the component's lifecycle.
Import#
import { useInitialValue } from '@volue/wave-react';
Example#
API Reference#
Arguments#
Prop | Type | Default |
|---|---|---|
value* | T | (() => T) | — |
Returns#
T — The value from the initial render, which remains constant regardless of subsequent prop changes.