Replies: 2 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
@snnsnn, I'm not comparing const updateNames = () => {
console.log("Button Clicked");
batch(() => {
setFirstName(firstName() + "n");
setLastName(lastName() + "!");
})
} we'd do something along these lines: const updateNames = batchCallback(() => {
console.log("Button Clicked");
setFirstName(firstName() + "n");
setLastName(lastName() + "!");
}) It's just a small change to write less code. |
Beta Was this translation helpful? Give feedback.
-
It would be nice to have a
batchCallback
version of thebatch
function that wraps a callback directly (the same way React providesuseCallback
even though you could achieve the same thing withuseMemo
). The reason behind that is it seems thatbatch
is mostly used with callback functions similar to how it's explained in the tutorials. So my proposal is to add something like this:Beta Was this translation helpful? Give feedback.
All reactions