useUnmount

February 26, 2019 · View on GitHub

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

用法

import {useUnmount} from 'react-use';

const Demo = () => {
  useUnmount(() => console.log('UNMOUNTED'));
  return null;
};

参考

useUnmount(mount);