shadcn-ahooks

useUpdateLayoutEffect

A hook alike useLayoutEffect but skips running the effect for the first time.

Overview

A hook alike useLayoutEffect but skips running the effect for the first time.

Documentation and Examples

Installation

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

A hook alike useLayoutEffect but skips running the effect for the first time.

Examples

Basic usage

API

The API is exactly the same as React.useLayoutEffect.

useUpdateEffect(
  effect: React.EffectCallback,
  deps?: React.DependencyList,
)

On this page