1.0.2 • Published 4 months ago

@so-fe/react-use-unmount v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@so-fe/react-use-unmount

一个简单的 React Hook,用于在组件卸载时执行回调函数。

📦 安装

npm install @so-fe/react-use-unmount

或者

yarn add @so-fe/react-use-unmount

或者

pnpm add @so-fe/react-use-unmount

🔨 使用

基本用法

import {useUnmount} from '@so-fe/react-use-unmount';

function Demo() {
    useUnmount(() => {
        console.info('组件已卸载');
    });

    return <div>示例组件</div>;
}

API

function useUnmount(fn: () => void): void;

参数

参数说明类型默认值
fn组件卸载时执行的回调函数() => void-
1.0.2

4 months ago

1.0.0

4 months ago