mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
379 B
379 B
useLifecycles
React lifecycle hook that call mount and unmount callbacks, when
component is mounted and un-mounted, respectively.
Usage
import {useLifecycles} from 'react-use';
const Demo = () => {
useLifecycles(() => console.log('MOUNTED'), () => console.log('UNMOUNTED'));
return null;
};
Reference
useLifecycles(mount, unmount);