rooks
Version:
Collection of awesome react hooks
9 lines (8 loc) • 334 B
TypeScript
/**
* useSafeSetState
* @description set state but ignores if component has already unmounted
* @see {@link https://rooks.vercel.app/docs/hooks/useSafeSetState}
*/
import { SetStateAction, Dispatch } from "react";
declare function useSafeSetState<T>(initialState: T): [T, Dispatch<SetStateAction<T>>];
export { useSafeSetState };