Flushing Reactions API reference for triggering reactivity refresh-cw Guide

Flushing Reactions

Flushing triggers all reactive contexts to update with their current value.

See the dedicated tutorial on flushing for more information on how to use.

scheduleFlush

Schedules a flush of all pending reactions.

Async Flush - Reactions run using microtask queues which means that they will not immediately occur unless flush is used.

Syntax

Reaction.scheduleFlush()

Usage

import { Reaction } from '@semantic-ui/reactivity';
Reaction.scheduleFlush();

flush

Immediately runs all pending reactions.

Syntax

Reaction.flush()

Usage

import { Reaction } from '@semantic-ui/reactivity';
Reaction.flush();

afterFlush

Schedules a callback to run after the next flush.

Syntax

Reaction.afterFlush(callback)

Parameters

NameTypeDescription
callbackFunctionThe function to run after the flush

Usage

import { Reaction } from '@semantic-ui/reactivity';
Reaction.afterFlush(() => {
console.log('Flush completed');
});