Skip to content
usefy

useMount

Lifecycle & refs

Runs a callback once when the component mounts

Install

$ npm install @usefy/use-mount

Quick start

useMount.tsx
import { useMount } from "@usefy/use-mount";

useMount(() => {
  analytics.page();
  return () => cleanup();
});

API reference

useMount(effect) — runs effect once on mount; an optional returned function runs on unmount.

Go deeper

This page is the quick reference. For every example, prop, and edge case, read the full README — or open Storybook to change props live.

More in lifecycle & refs