BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/retab-ui/use-mount-effect

Use Mount Effect

retab-ui/use-mount-effect
FreeHook

A mount-only effect hook for explicit lifecycle escape hatches.

Install it

npx shadcn@latest add https://ui.retab.com/r/use-mount-effect.json

Source

hooks/use-mount-effect.tsui.retab.com/r/use-mount-effect.json
1"use client";
2
3import { useEffect } from "react";
4
5/**
6 * Run an effect exactly once on mount. The returned cleanup (if any) runs on unmount.
7 *
8 * Use this instead of `useEffect(fn, [])` so intent is explicit and the escape
9 * hatch is greppable. See `no-use-effect.md` for the five replacement patterns
10 * and when this hook is actually the right answer (DOM integration, third-party
11 * widget lifecycles, browser API subscriptions, stable singleton dependencies).
12 */
13export function useMountEffect(effect: () => void | (() => void)) {
14 // eslint-disable-next-line no-restricted-syntax
15 useEffect(effect, []);
16}

Files it writes

  • hooks/use-mount-effect.ts

Facts

Registry
retab-ui
Type
registry:hook
Access
Free
Files written
1
Licence
NOASSERTION
First indexed
2026-08-04
Last confirmed
today

Go to the source

ui.retab.com retab-dev/retab-ui on GitHub Raw registry item This item as JSON

More from retab-ui

All 130 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Use Keyed Layout Effectuse-keyed-layout-effectretab-uiHooksFreeno deps
Use Keyed Mount Effectuse-keyed-mount-effectretab-uiHooksFreeno deps
Use Mobileuse-mobileretab-uiHooksFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex