batch
Batches multiple state updates into a single notification.
Signature
Section titled “Signature”import { batch } from '@reaxium/core';
function batch(fn: () => void): void
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
fn | () => void | Function to execute in batch. |
Example
Section titled “Example”const a = atom(0);const b = atom(0);batch(() => { a.set(1); b.set(1);});