This is the dev preview website. Check out the document at lynxjs.org

Home > @lynx-js/react > useEffect

useEffect() function

Accepts a function that contains imperative, possibly effectful code. The effects run after main thread dom update without blocking it.

Signature:

useEffect: (effect: EffectCallback, deps?: DependencyList) => void

Parameters

Parameter

Type

Description

effect

EffectCallback

Imperative function that can return a cleanup function

deps

DependencyList

(Optional) If present, effect will only activate if the values in the list change (using ===).

Returns:

void