Skip to content

Instantly share code, notes, and snippets.

View lanre-mark's full-sized avatar
😤

'olanrewaju Makinde lanre-mark

😤
View GitHub Profile
@codemile
codemile / useSafeState.tsx
Created March 19, 2021 11:10
Here is a useSafeState hook that ignores state changes after a component has been unmounted.
import {
DependencyList,
Dispatch,
MutableRefObject,
SetStateAction,
useCallback,
useEffect,
useRef,
useState
} from 'react';