top | item 35215542

(no title)

meotimdihia | 2 years ago

SSR solves the problem: "the content does not render before your browser download JS."

discuss

order

deepsun|2 years ago

Sorry what JS? With aforementioned Apache Struts there's no need for JS to render anything.

But if one wishes, JS can be added, of course (e.g. for DHTML stuff). To avoid render blocking there are "defer" and "async" attributes.

noisem4ker|2 years ago

To clarify: it's a CSR problem to solve, not Struts' (which, as you say, is not subject to).

To answer your original question in a pragmatic way: people used to JS tooling, libraries, frameworks obviously want to continue using these, not revert to Struts. Plus, modern tooling facilitates mixing SSR and CSR, and switching between them as needed.

meotimdihia|2 years ago

I have 8 years of PHP experience. Let me explain to you. While you can build a static website with Apache Struts or PHP, you must add javascript if you want to build complex sites anyway, for example: Facebook, Twitter, Tiktok,... In the past, everyone used jQuery, but jQuery and ajax can't build complex sites. You will end up with too many Ajax + dynamic elements + bad practices and can't maintain them if you use jQuery.

Finally, you'll end up using React for easy to maintain. And you'll have to wait to load React + related packages => it is slow for initial render => and SSR solved the problem.

Also, you just need a single team to build a complex application while using React instead of backend + frontend as traditionally.