DEV Community

Discussion on: React/Vue components are just server side template components with worse performance. Change my mind.

Collapse
 
tobiassn profile image
Tobias SN

You can render React and Vue sites server-side if you want, or even pre-render them and serve them over a CDN.

Collapse
 
autoferrit profile image
Shawn McElroy

To me this is worse. There's already complexity over using normal server side temolatea. Now your adding a later to render html output from JavaScript (jsx) to then load to the browser.

The less layers you have to break means the less code you have to break.

Collapse
 
tobiassn profile image
Tobias SN

Not really. There are already tools that do it for you, like vue-server-side-renderer and prerender-spa-plugin. You don’t even have to set them up yourself. Run npx create-nuxt-app <name>, answer a few questions, and you can have a full Vue SPA that can be served statically, supports server-side rendering, and has both a component library/CSS framework and server framework set up for you. If that’s not easy to do, nothing else is.

Thread Thread
 
autoferrit profile image
Shawn McElroy

Yes, I know it's not hard to get it pre-rendered. But it is another step, however minor.

My main argument, is that now you have a whole front end layer of react/vue/angular/whatever which is a lot of added complexity that you need to build, test, integrate, and so on. It is easier to have that break than a simple template.

To me, that added complexity isn't worth it. Even in django/flask and im sure others like rails, you can have it generate a static site when you run the server and have it be seamless too. But theres no cognitive overhead of having to worry about a frontend framework which so far in my experience is way harder to learn than simple templating.

Thread Thread
 
tobiassn profile image
Tobias SN

Well, I invite you to go try it.