본문으로 건너뛰기

useUnmount

컴포넌트가 언마운트될 때 콜백 함수를 호출하는 커스텀 훅입니다.


Code

🔗 실제 구현 코드 확인


Interface

typescript
function useUnmount(callback: () => void): void

Parameters

NameTypeDescription
callback() => void언마운트 시 호출될 콜백 함수

Usage

typescript
import { useUnmount } from '@modern-kit/react';

const Example = () => {
useUnmount(() => console.log("unmount"));

return <>{/* ... */}</>;
};