4 ms·
You’re paying the price of initializing react twice and generating the dom: once on the serve side and then again on client before page is interactive.
by ec109685 4y ago
You’re paying the price of initializing react twice and generating the dom: once on the serve side and then again on client before page is interactive.
- jayflux 4y agoNot quite, the second time doesn’t “generate the dom”, it just hydrates, fills in the gaps and binds event listeners. It’s not starting from scratch and isn’t a big cost.
- ec109685 4y agoIt generates the shadow dom is what I meant.
- v0idzer0 4y agoThere’s no DOM on the server and you only generate it once on the client. 1) The server generates html (a string). 2) Browser receives html and builds DOM just like in any static website 3) Javascript downloads and react sees the DOM already exists and does nothing