3 ms·
> I wonder... am I good if the static render is < 14kb, but I load React etc. and hydrate for progressive addition of interactivity? Ten years ago, we had a be
by Cyberdog 4y ago
> I wonder... am I good if the static render is < 14kb, but I load React etc. and hydrate for progressive addition of interactivity?
Ten years ago, we had a best practice in client-side web development called progressive enhancement. The idea was that you load a web page which is fully functional without JavaScript, then use JS to add whatever glitzy client-side interaction you want to add - but importantly, just as enhancement, so whatever needed to be done on the page could be done, perhaps in an uglier or more awkward way but still doable, before a single line of JavaScript runs.
It sounds like you might have rediscovered this concept, and if so, yes, good, please do it. I'm not sure if React will even let you work this way, though.
- quickthrower2 4y agoReact doesn’t stop you (it is just a library) but doesn’t help you either. NextJS helps with this kind of thing by letting you statically generate server side the first render in React (you can load data in prior from a source if needed) and then you can CDN that page. You could also do this in rails but NextJS saves you needing say a moustache or ERB version of the same page for the static render. You use the same code for build time, back end runtime and front end. Lovingly called isomorphic programming or as cynics call it: monoglot! I knew of the progressive enhancement concept but what I didn’t know was the 14kb thing. It is motivating me to experiment!