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
| Name | Type | Description | Default |
|---|---|---|---|
| effect | React.EffectCallback | Effect callback. | - |
| deps | React.DependencyList | Dependency array. | - |
Returns
| Name | Description |
|---|---|
| void | No 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.