4 ms·
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 mar
by stevemk14ebr 5y ago
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
- brundolf 5y agoRight, 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.