4 ms·
One of the core propositions of Javascript SSR is that you can write everything in the same way. If you have your data at compile-time, great, it can get preren
by Etheryte 4y ago
One of the core propositions of Javascript SSR is that you can write everything in the same way. If you have your data at compile-time, great, it can get prerendered and bundled. If not, it can be rendered on the client, the code you use it the same. You can share the logic for both, same components, same layouts, same business logic etc. You can have initial data rendered on the server and then live updates one the client side without any additional work around templating and business logic.
Obviously, there are ways to write the same page and end up with a smaller bundle size, but size is only one dimension. Javascript SSR offers (arguably) less development time and less maintenance (as there's simply less code since you handle both the same way) at the expense of other things, such as bundle size etc. As with any other tradeoff, you can't only look at one parameter and say a thing is good or bad, you need to look at the whole package and figure out whether it makes sense in the given context or not.
- codethief 4y agoI fully agree and would add: Component-oriented frameworks like React/Angular/Vue/… give you the ability to easily test your components individually (in the sense of unit tests or integration tests or manual tests / storybooks). Most classic templating languages for the backend don't offer anything similar and doing that would also be quite challenging: Most of the time the backend controller rendering/populating a given template is deeply entwined with business logic and database calls – good luck separating those concerns after the fact.