useUnmount

当组件被卸载时,调用 unmount 回调的生命周期钩子。

用法

  1. import {useUnmount} from 'react-use';
  2. const Demo = () => {
  3. useUnmount(() => console.log('UNMOUNTED'));
  4. return null;
  5. };

参考

  1. useUnmount(mount);