Table of Contents

Method UseEffect

Namespace
Velvet
Assembly
Velvet.Docs.dll

UseEffect(Func<Action?>?, object?[]?)

Position-based asynchronous effect. Runs at the next frame boundary, after the frame is painted.

public static void UseEffect(Func<Action?>? factory, object?[]? deps = null)

Parameters

factory Func<Action>

Effect body. Returns a cleanup Action invoked on unmount or when deps change.

deps object[]

Dependency array. When deeply equal to the previous render, the effect is skipped. When omitted or null, the effect runs on every render.

UseEffect(Func<IDisposable>, object?[]?)

IDisposable variant.

public static void UseEffect(Func<IDisposable> factory, object?[]? deps = null)

Parameters

factory Func<IDisposable>

Effect body returning an System.IDisposable. Disposed on unmount or when deps change.

deps object[]

Dependency array. When deeply equal to the previous render, the effect is skipped. When omitted or null, the effect runs on every render.