Skip to main content
Home

Built and signed on GitHub Actions

It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
88%
Published
a month ago (1.1.4)

@m0n0lab/react-hooks

npm version react-hooks coverage react-hooks bundle

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-hooks

pnpm

pnpm add @m0n0lab/react-hooks

JSR

npx jsr add @m0n0lab/react-hooks

Usage

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

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@m0n0lab/react-hooks

Import symbol

import * as react_hooks from "@m0n0lab/react-hooks";
or

Import directly with a jsr specifier

import * as react_hooks from "jsr:@m0n0lab/react-hooks";

Add Package

pnpm i jsr:@m0n0lab/react-hooks
or (using pnpm 10.8 or older)
pnpm dlx jsr add @m0n0lab/react-hooks

Import symbol

import * as react_hooks from "@m0n0lab/react-hooks";

Add Package

yarn add jsr:@m0n0lab/react-hooks
or (using Yarn 4.8 or older)
yarn dlx jsr add @m0n0lab/react-hooks

Import symbol

import * as react_hooks from "@m0n0lab/react-hooks";

Add Package

vlt install jsr:@m0n0lab/react-hooks

Import symbol

import * as react_hooks from "@m0n0lab/react-hooks";

Add Package

npx jsr add @m0n0lab/react-hooks

Import symbol

import * as react_hooks from "@m0n0lab/react-hooks";

Add Package

bunx jsr add @m0n0lab/react-hooks

Import symbol

import * as react_hooks from "@m0n0lab/react-hooks";