For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/react.useeffect.md.
这是开发预览网站。请访问正式文档 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