setLoading
@spartanfx/react / setLoading
Function: setLoading()
setLoading(
message):void
Imperative API to show (or update) the global loading overlay.
Parameters
message
string = DEFAULT_MESSAGE
Optional message to display in the overlay.
Returns
void
void
Remarks
- If this is the first active loader (
activeLoadersis 0), it initializes a Notiflix "pulse" overlay with configured options. - If one or more loaders are already active, this updates the displayed message instead.
- Each call increments the internal
activeLoaderscounter; consumers must pair each call with a corresponding removeLoading to avoid leaking the overlay.
Example
// Show a loader imperatively during an async task
setLoading('Saving changes…');
try {
await save();
} finally {
removeLoading();
}