Update multiple signals at once. Prevent unnecessary re-renders and boost speed!
batch()Watch the render counter - batching triggers way fewer renders!
👆 Click the buttons above and watch the render count! Batching keeps it low 🚀
import { useSignal } from 'signalforge/react';
import { batch } from 'signalforge/core';
const [count1, setCount1] = useSignal(0);
const [count2, setCount2] = useSignal(0);
// ❌ Without batch - multiple re-renders
setCount1(count1 + 1);
setCount2(count2 + 1);
// ✅ With batch - single re-render
batch(() => {
setCount1(count1 + 1);
setCount2(count2 + 1);
});