Batched updates
See original GitHub issueDepending on the store/action design of an app, batching updates can be a pretty useful/important perf optimization. @yoshuawuyts what are you thoughts on the best choo
-like way to handle this? Would you be interested in adding a hook that would make this possible in some app-wide way (like maybe a way to provide ‘middleware’ function through which updated states were passed before being emitted to the view-rendering)? Or would you prefer for people to handle this by simply throttling individual view functions?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Simplifying state management in React apps with batched ...
By default, React batches updates made in a known method like the lifecycle methods or event handlers, but doesn't do the same when...
Read more >Automatic Batching in React 18: What You Should Know
React uses batching to group state updates within event handlers and inbuilt hooks. It prevents components from re-rendering for each state update and ......
Read more >Understanding React.js (Part 2) - Batched Updates
React implements a batched updating mechanism to reduce the number of component renders. Consequently, multiple state changes will be ...
Read more >React state batch updating - reduce re-renders - Medium
React mechanism of state batch updates. Instead of one by one, React does batch updates, reducing the number of hooks and class component ......
Read more >React 18 adds automatic batching - Saeloun Blog
Batching is a React feature that combines all the state updates into a single update, causing a single re-render thereby improving the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@yoshuawuyts I haven’t given it an actual test drive, but from a read of the code the approach looks great to me! I have a couple of thoughts but I’ll post them as issues over in nanoraf.
Ooh, yeah I’ve been considering this; combined with documenting best practices on thunking views and caching routes (https://github.com/yoshuawuyts/sheet-router/issues/17) it would def be worthwhile to put an upper cap on flushing updates.
In the past for
virtual-dom
applications I used yoshuawuyts/virtual-raf to flush updates at 60fps; it could def be worthwhile exploring this forchoo
too - especially the interaction with webworker rendering would become interesting (https://github.com/maxogden/yo-yo/issues/22).I think this should happen after the
3.0
release though; as it’s a minor tweak without practical API changes. Does this answer what you meant? Cheers!