Re:Using React, Redux and SSR to acommodate users without Ja...
by SimeVidas on Sunday June 07, 2020 @02:45PM
(#23449565)
The thing that I don’t understand is, how can the browser render the SSR content if the JS bundle is render-blocking? Doesn’t the JS bundle prevent anything from rendering until all its JS has been executed?
Re:Using React, Redux and SSR to acommodate users without Ja...
by danielskogly on Sunday June 07, 2020 @03:38PM
(#23450072)
It's only render-blocking if put before the content! You can actually see this if you load up the demo[0] and reload the page. For some reason, I've made the mistake of putting the script-tag for the JS bundle _after_ the main content but _before_ the footer. The footer is also rendered on the server, but you'll see - especially if you throttle your connection - that the main app will appear instantly, but the footer ("Try without javascript :)", etc.) won't appear until the JS has finished loading.
This is why today it's common to put script-tags for external JS at the end of the body-tag.
[0] https://news.ycombinator.com/item?id=23446779
[1] https://reactjs.org/docs/react-dom-server.html#rendertostrin...
[2] https://reactjs.org/docs/react-dom-server.html#rendertostati...