top | item 34171859

(no title)

mhfu | 3 years ago

I like to use React for it's component system. Those components don't even have to be reusable, I just like working with them, it's way easier to separate and organize code and it makes me more productive when I have to find and change anything. I don't like huge html files. If I need static sites, things like Nextjs and Astro are great for that.

discuss

order

zelphirkalt|3 years ago

Where do huge HTML files come from? Using traditional templating engines does not at all mean, that you will have huge HTML files. Traditional templating engines like Jinja2 allow splitting up templates in very modular ways.

Separate template files can be organized neatly into directories and subdirectories as well. Templates in general can reside in their own "templates" directory and do not need to be mingled with the code. It is very clear where to look to find things.

The idea is, that you have modular statically rendered pages and then on some pages also serve a frontend framework for interactive components. I know that at least VueJS was able to be run like this. In the end, even with React or whatever other framework of its kind you use, you are still serving some HTML and some script tags, which may or may not include React, VueJS, or whatever else is the thing at the time. I am guessing, that React can work the same way that VueJS can, by simply including it on some rendered page templates, but I have not tried it.