@usefy/use-update-effect
v0.25.1
Published
A React useEffect variant that skips the first render
Maintainers
Readme
Overview
useUpdateEffect is part of the @usefy ecosystem — a collection of production-ready, TypeScript-first, SSR-safe React hooks. A useEffect variant that skips the first render.
Features
- Skips mount — no effect on the first render
- Same signature —
(effect, deps)just likeuseEffect - Cleanup supported — return a cleanup as usual
- TypeScript-first — full type inference and exported types
- Tiny & tree-shakeable — zero dependencies, published as its own package
Installation
# npm
npm install @usefy/use-update-effect
# yarn
yarn add @usefy/use-update-effect
# pnpm
pnpm add @usefy/use-update-effectRequires React 18 or 19 (peerDependencies: "react": "^18.0.0 || ^19.0.0").
Quick Start
import { useUpdateEffect } from "@usefy/use-update-effect";
useUpdateEffect(() => {
// runs only when `query` changes, not on mount
search(query);
}, [query]);API
useUpdateEffect(effect, deps?) — same as useEffect but does not run on the initial render.
Testing
📊 View Detailed Coverage Report (GitHub Pages) — 6 tests, 100% statement coverage.
License
MIT © mirunamu
This package is part of the usefy monorepo.
