致谢: Re-export from react-use
React 生命周期 Hook,在组件即将卸载时调用一个函数。如果你需要同时使用挂载和卸载函数,请使用 useLifecycles。
useLifecycles
import { useUnmount } from "@lynx-js/react-use"; const Demo = () => { useUnmount(() => { console.log("UNMOUNTED"); }); return null; };
declare const useUnmount: (fn: () => any) => void;