The function to be run in an action.
let a = atom(0, { name: "a" });
let b = atom(0, { name: "b" });
let count = 0;
a.subscribe(() => {
count++;
runInAction(() => {
b.value = a.value;
});
});
a.value++;
console.log(a.value, b.value, count); // 1 1 1
Runs the given function in an action, i.e. when there are no active subscribers. This is useful for making changes to reactive items without triggering subscribers.