@m0n0lab/react-hooks
v1.1.4
Published
[](https://www.npmjs.com/package/@m0n0lab/react-hooks) [](https://codecov.io/gh/pabloimrik17
Downloads
10
Readme
@m0n0lab/react-hooks
A collection of React lifecycle hooks for functional components. Simplify your React development with clean, reusable, well-tested, and type-safe hooks.
Features
- 🚀 Production ready
- 📘 Well documented
Installation
npm
npm install @m0n0lab/react-hookspnpm
pnpm add @m0n0lab/react-hooksJSR
npx jsr add @m0n0lab/react-hooksUsage
import { useDidMount, useWillUnmount } from "@m0n0lab/react-hooks";
function MyComponent() {
useDidMount(() => {
console.log("Component mounted");
});
useWillUnmount(() => {
console.log("Component will unmount");
});
return <div>Hello World</div>;
}API
useDidMount(callback: () => void): void
Executes the callback once when the component mounts.
useWillUnmount(callback: () => void): void
Executes the callback when the component is about to unmount.
License
MIT
