Table of Contents

Method UseLayoutEffect

Namespace
Velvet
Assembly
Velvet.Docs.dll

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

Position-based layout effect. Runs synchronously immediately after Render completes, before the frame is painted.

public static void UseLayoutEffect(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.

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

IDisposable variant. Dispose() is called when deps change.

public static void UseLayoutEffect(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.