UNPKG

state-hooks

Version:

Essential set of React Hooks for convenient state management.

17 lines (16 loc) 551 B
/** * Records states of a value over time. * * @param value Props, state or any other calculated value. * @param maxLength Maximum amount of states to store at once. Should be an integer greater than 1. * @returns Results of state updates in chronological order. * * @example * function Component() { * const [count, setCount] = useState(0); * const counts = useTimeline(count); * // ... * return `Now: ${count}, history: ${counts}`; * } */ export default function useTimeline<T>(value: T, maxLength?: number): ReadonlyArray<T>;