shadcn-ahooks

useMount

A hook that executes a function after the component is mounted.

Overview

A hook that executes a function after the component is mounted.

Documentation and Examples

Installation

Open in
pnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useMount.json
npx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useMount.json
yarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useMount.json
bun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useMount.json

A hook that executes a function after the component is mounted.

Examples

Default Usage

API

useMount(fn: EffectCallback);

Params

| Property | Description | Type | Default | | -- | ---- | | fn | The function to be executed | EffectCallback | - |

On this page