React lifecycle hook that call mount
and unmount
callbacks, when
component is mounted and un-mounted, respectively.
import {useLifecycles} from 'react-use';
const Demo = () => {
useLifecycles(() => console.log('MOUNTED'), () => console.log('UNMOUNTED'));
return null;
};
useLifecycles(mount, unmount);