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

PropertyDescriptionTypeDefault
fnThe function to be executedEffectCallback-

On this page