Re:React Concurrent Mode
by chacham15 on Thursday October 24, 2019 @02:49PM
(#21347876)
The problem is that you want to be able to abandon work (e.g. due to new data coming in that invalidated the previous data). So, what you need is to go back to the last complete render and start applying your changes from there. If there were partial changes applied from before, you cant just skip the middle update.
[ Parent
| on HN ]
OK I've spent all morning reading about this. I think that when you say "work", you're talking about the work of doing DOM updates. Rendering a VDOM is still considered cheap.
The "work" is the arbitrary JavaScript in the `render()` function. In Concurrent mode, a `render()` function that renders 1000 children can now be interrupted "between" renders of all those children.
It's akin to doing `Header( LoginLink( GetLoginName() ) )` versus
``` Header(); check_for_interrupt(); LoginLink(); check_for_interrupt(); ... ```
The interrupt between rendering components (pieces of work) can now cancel the whole render operation (because say, the parent component has now been updated / wants to be re-rendered), or can pause the render tree while something like a high-priority animation frame is rendered.