UNPKG

react-native-ui-lib

Version:

[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)

16 lines (15 loc) 371 B
import { useEffect, useRef } from 'react'; /** * This hook avoid calling useEffect on the initial value of his dependency array */ const useDidUpdate = (callback, dep) => { const isMounted = useRef(false); useEffect(() => { if (isMounted.current) { callback(); } else { isMounted.current = true; } }, dep); }; export default useDidUpdate;