import { Dispatch, SetStateAction } from 'react'; import { AsyncSetState } from './useStateAsync'; type StateSetter = Dispatch>; /** * `useSafeState` takes the return value of a `useState` hook and wraps the * setter to prevent updates onces the component has unmounted. Can used * with `useMergeState` and `useStateAsync` as well * * @param state The return value of a useStateHook * * ```ts * const [show, setShow] = useSafeState(useState(true)); * ``` */ declare function useSafeState(state: [TState, AsyncSetState]): [TState, (stateUpdate: React.SetStateAction) => Promise]; declare function useSafeState(state: [TState, StateSetter]): [TState, StateSetter]; export default useSafeState;