ahooks
Version:
react hooks library
10 lines (9 loc) • 382 B
TypeScript
import type { Dispatch, SetStateAction } from 'react';
type GetStateAction<S> = () => S;
declare function useGetState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>, GetStateAction<S>];
declare function useGetState<S = undefined>(): [
S | undefined,
Dispatch<SetStateAction<S | undefined>>,
GetStateAction<S | undefined>
];
export default useGetState;