I wonder... am I good if the static render is < 14kb, but I load React etc. and hydrate for progressive addition of interactivity?
Probably for a blog, if the readable content is in that static render, it would be a reasonable experience. A couple of seconds later the cool interactive parts come to life.
===
PageSpeed Insights scores:
Performance: 100%
First Contentful Paint: 0.9 s
Time to Interactive: 0.9 s
Speed Index: 0.9 s
Total Blocking Time: 0 ms
Largest Contentful Paint: 0.9 s
Cumulative Layout Shift: 0
Meh. Not bad.
Ok it's very good. Perfect. When you click around, it doesn't seem like a traditional client/server app, but like a SPA. Without being one!
> 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.
React 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!
Probably for a blog, if the readable content is in that static render, it would be a reasonable experience. A couple of seconds later the cool interactive parts come to life.
===
PageSpeed Insights scores:
Performance: 100% First Contentful Paint: 0.9 s Time to Interactive: 0.9 s Speed Index: 0.9 s Total Blocking Time: 0 ms Largest Contentful Paint: 0.9 s Cumulative Layout Shift: 0
Meh. Not bad.
Ok it's very good. Perfect. When you click around, it doesn't seem like a traditional client/server app, but like a SPA. Without being one!