#32LifecycleEasy

useLifecycles

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);
// TODO: implement useLifecycles
function notImplemented(..._args: any[]): any {
  throw new Error('Not implemented');
}
export default notImplemented;
export const useLifecycles = notImplemented;

Open browser consoleTests