Skip to main content

rawEffect()

rawEffect(fn, options?): DisposeFn

Defined in: js-api/src/u2core/signals-core.ts:969

Create an effect to run arbitrary code in response to signal changes.

An effect tracks which signals are accessed within the given callback function fn, and re-runs the callback when those signals change.

The callback may return a cleanup function. The cleanup function gets run once, either when the callback is next called or when the effect gets disposed, whichever happens first.

Parameters

ParameterTypeDescription
fnEffectFnThe effect callback.
options?EffectOptions-

Returns

DisposeFn

A function for disposing the effect.