UNPKG

@up-group-ui/react-controls

Version:
8 lines (7 loc) 506 B
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;