ahooks
Version:
react hooks library
4 lines (3 loc) • 300 B
TypeScript
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 const useSetState: <S extends Record<string, any>>(initialState: S | (() => S)) => [S, SetState<S>];
export default useSetState;