Re:What's New in React 18?
by stevemk14ebr on Wednesday September 29, 2021 @09:30PM
(#28702221)
In my case the right hand preview being generated is literally HTML that is presented as formatted markdown. The solution for me was to detach the generated markdown html tree from the creation of the react elements. You can have the worker return a json tree shape that defines all the elements it wishes to place onto the dom, ships it over to the main react element that React.CreateElement's through the tree.
This way the cached elements can be shown until the new tree elements are created and you can just react setState to the new elements and it's instant
Re:What's New in React 18?
by brundolf on Wednesday September 29, 2021 @10:21PM
(#28702502)
Right, so you're offloading the markdown processing but not the actual React render logic. Reasonable enough for this case, but doesn't translate to the majority of scenarios.
This way the cached elements can be shown until the new tree elements are created and you can just react setState to the new elements and it's instant