useLink
Creates a reactive AnimationLink instance that can be directly passed into an Animate component for high-performance updates without causing full React component re-renders.
Importing
1
import { useLink } from '@infinityfx/lively/hooks';Usage
Click to update Link value dynamically
Call signature
1
const link = useLink<T>(initial)
1
const link = useLink<T, K>(initialLink, transform)
Parameters
initial:
T | AnimationLink<T> The initial state value or source AnimationLink instance.
transform?:
(value: T, index: number) => K An optional transformation function to derive values when linking from an existing AnimationLink.
Returns
link:
AnimationLink<T> An AnimationLink object that can be passed to Animate properties or updated via .set(value, options).