UNPKG

ziko

Version:

A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...

26 lines (22 loc) 632 B
export function useState<T>( initialValue: T ): [ /** getter function */ () => { value: T; isStateGetter: () => true; _subscribe: (fn: (value: T) => void) => void; }, /** setter function */ (newValue: T | ((prev: T) => T)) => void, /** controller */ { pause: () => void; resume: () => void; clear: () => void; force: (newValue: T | ((prev: T) => T)) => void; getSubscribers: () => Set<(value: T) => void>; } ]; /** check if argument is a state getter */ export function isStateGetter(arg: any): boolean;