Automatic batching for fewer renders
@yyx990803 React 18 will bring smarter, automatic batching. This optimization can be significant and therefore this issue is about wether the Vue implementation has room for improvement regarding this or not?
Notably:
Until React 18, we only batched updates during the React event handlers. Updates inside of promises, setTimeout, native event handlers, or any other event were not batched in React by default. [In v18] updates inside of timeouts, promises, native event handlers or any other event will batch the same way as updates inside of React events. We expect this to result in less work rendering, and therefore better performance in your applications
Vue has had fully automatic batching for updates triggered from all sources since the very first version of Vue 2 (released in 2016).
It's actually baffling that React still doesn't have it today.
@yyx990803 thanks for the confirmation however would it make sense to provide a way to prevent a batch update like with ReactDOM.flushSync()
?
I don't see why Vue batching would always be desirable and not on the react proposal, I don't see a differentiating factor here. (or maybe Vue already expose a method for this?)