Use Mount Effect
retab-ui/use-mount-effectFreeHook
A mount-only effect hook for explicit lifecycle escape hatches.
Install it
npx shadcn@latest add https://ui.retab.com/r/use-mount-effect.jsonSource
1"use client";23import { useEffect } from "react";45/**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 escape9 * hatch is greppable. See `no-use-effect.md` for the five replacement patterns10 * and when this hook is actually the right answer (DOM integration, third-party11 * widget lifecycles, browser API subscriptions, stable singleton dependencies).12 */13export function useMountEffect(effect: () => void | (() => void)) {14 // eslint-disable-next-line no-restricted-syntax15 useEffect(effect, []);16}
Files it writes
More from retab-ui
All 130 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Use Keyed Layout Effectuse-keyed-layout-effect | retab-ui | Hooks | Free | no deps | |
| Use Keyed Mount Effectuse-keyed-mount-effect | retab-ui | Hooks | Free | no deps | |
| Use Mobileuse-mobile | retab-ui | Hooks | Free | no deps |
