Skip to content

reactivity API

@elfui/reactivity is a responsive portal that can be used independently. Application and macro components are first imported from @elfui/core; only when you really need to use the reactive system without component runtime, you can directly rely on this package.

Stable application API

state

useRefuseReactiveuseShallowRefuseShallowReactive

Derivations and side effects

useComputeduseEffectwatchonWatcherCleanup

Use useEffect() for automatically tracked effects and watch() for explicit sources, old/new values, deep, or immediate behavior.

Scheduling

nextTickqueueJobqueuePostFlushJobflushSync

tool

readonlyisReadonlyisStateisRefisReactiveisProxymarkRawtoRawunreftoValue

Scope

effectScopegetCurrentScopeonScopeDispose

High-level low-level API

WARNING

The following symbols are publicly exported and are mainly used by framework extensions, adapters and diagnostic tools; ordinary business code should not directly call or rely on their internal state.

  • effect: effectstopReactiveEffectisTrackingpauseTrackingresetTrackinguntrack
  • Dependency graph: track, trigger, triggerAll
  • scope internals: EffectScoperecordEffectScope
  • scheduler internals: isSyncMode
  • state flags: REACTIVE_FLAGREF_FLAGSTATE_FLAG

TIP

These APIs are still subject to the beta version; they are not recommended APIs for the @elfui/core main entrance. If they are adjusted in the future, they will be separately stated in the change record of @elfui/reactivity.