@leafygreen-ui/hooks
Version:
LeafyGreen UI Kit Custom Hooks
13 lines • 434 B
TypeScript
/**
*
* A combination of useState and useRef,
* returns the current state, a `setState` and a `getState` function.
*
* Use the `getState` function inside an event listener callbacks
* in order to avoid referencing a stale state
*
* @param initial
* @returns [state, setState, getState]
*/
export declare function useStateRef<T extends any>(initial: T): [T, (x: T) => void, () => T];
//# sourceMappingURL=useStateRef.d.ts.map