UNPKG

react-native-ui-lib

Version:

<p align="center"> <img src="https://user-images.githubusercontent.com/1780255/105469025-56759000-5ca0-11eb-993d-3568c1fd54f4.png" height="250px" style="display:block"/> </p> <p align="center">UI Toolset & Components Library for React Native</p> <p a

17 lines (15 loc) 379 B
import React, { 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;