Usage notes
Primitive results use Object.is; arrays and plain objects compare their own enumerable fields shallowly. Supply isEqual for another selection policy. This hook excludes per-frame playback and edit-preview updates. Use useTimelinePlayheadTime for a live playback readout.
Signature
useTimelineSelector(selector: (state: object) => Value, isEqual: (previous: Value, next: Value) => boolean = shallowEqual): ValueType parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
Value | None | None | Selected value, including primitive values. |
Parameters
| Name | Type | Description |
|---|---|---|
| selector | (state: object) => Value | Pure projection of the readonly timeline snapshot. |
| isEqual | (previous: Value, next: Value) => boolean | Equality check used to preserve the last selected value. |
Returns
Value
The selected value, updated only when its equality check changes.
Examples
import { useTimelineSelector } from '@techsquidtv/canvas-timeline-react';export function TrackCount() { const count = useTimelineSelector(state => state.tracks.length); return <output>{count}</output>;}