Documentation
useOnUnmount
Run cleanup only on component unmount.
Installation
pnpm add @rouf-dev/pantheon-uiUsage
"use client";
import { useOnUnmount } from "@rouf-dev/pantheon-ui";
export function SubscriptionDemo() {
useOnUnmount(() => {
console.log('Component unmounting');
unsubscribe();
cleanup();
});
return <div>Content</div>;
}Parameters
callback: Cleanup function to execute on unmount