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
factoryFunc<Action>Effect body. Returns a cleanup Action invoked on unmount or when
depschange.depsobject[]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
factoryFunc<IDisposable>Effect body returning an System.IDisposable. Disposed on unmount or when
depschange.depsobject[]Dependency array. When deeply equal to the previous render, the effect is skipped. When omitted or
null, the effect runs on every render.