Utility

useUpdateEffect

useEffect that skips the initial mount and only runs on updates.

import { useUpdateEffect } from "saha-ui"

Uses

Run effects only on updates (skip initial mount). Useful for side-effects that shouldn't run on first render.

Props

NameTypeDescriptionDefault
effectReact.EffectCallbackEffect callback.-
depsReact.DependencyListDependency array.-

Returns

NameDescription
voidNo return; wraps useEffect with mount-skipping logic.

Example

useUpdateEffect(() => {
  console.log('value changed');
}, [value]);

Notes

An internal ref tracks the first mount to skip running the effect initially.
Saha UI - The Modern React Component Library