useLazyEffect()
ts
function useLazyEffect(effect, deps?): void;Defined in: effect.ts:22
React hook of calling the effect only on updates, not on the first render.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
effect | EffectCallback | undefined | Effect callback to be executed on updates. |
deps | unknown[] | [] | Dependency array for the effect. The effect will be re-executed when any of the dependencies change. Default is an empty array, meaning the effect will only run on updates and not on the first render. |
Returns
void
Example
tsx
function MyComponent () {
useLazyEffect(() => {
console.log("This will not be logged on the first render, but will be logged on subsequent updates.");
})
}Since
1.0.0
Author
Simon Kovtyk