UNPKG

ahooks

Version:
5 lines (4 loc) 422 B
export type SetState<S extends Record<string, any>> = <K extends keyof S>(state: Pick<S, K> | null | ((prevState: Readonly<S>) => Pick<S, K> | S | null)) => void; declare function useSetState<S extends Record<string, any>>(initialState?: undefined): [Partial<S>, SetState<Partial<S>>]; declare function useSetState<S extends Record<string, any>>(initialState: S | (() => S)): [S, SetState<S>]; export default useSetState;