@up-group-ui/react-controls
Version:
Up shared react controls
8 lines (7 loc) • 506 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
declare type SetStateFn<T> = Dispatch<SetStateAction<T | undefined>>;
declare type SafeSetState<T> = [T | undefined, SetStateFn<T>];
export declare function useSafeState<T = undefined>(initialState?: T | (() => T | undefined)): SafeSetState<T>;
export declare const useSafeStateWithReducer: (initialValue: any) => any[];
export declare const useSafeStateWithReducerGeneric: <T>(initialValue: T) => (T | ((args: T) => void))[];
export default useSafeState;