4 ms·
You don’t need dependencies like webpack, react, or even any javascript at all to show static pages… and it would be a poor use of them just to write static htm
by chrischen 5y ago
You don’t need dependencies like webpack, react, or even any javascript at all to show static pages… and it would be a poor use of them just to write static html. But if you want interactive elements like image editors, rich text edition, fancy tables, then you start needing smarter and smarter build tools to bundle it all together and support the maintenance of interactive complex web applications.
I'd also argue that having a static build tool that generates HTML will also allow you to write more HTML and more complex HTML, as you can abstract away reusable components. So there are benefits even if you are serving non-interactive HTML pages. Just cache the React build output.
- ushakov 5y agowhy do i need React for any of this? most template engines have partials and some have macros (Jinja2) React-based static site generators are so slow that they’re unusable for any website that has more than a couple pages
- ratorx 5y agoThe developer experience is better. I personally like type safe templates, and just the JSX bits of React are one of the most mature type safe templating frameworks with very good editor support.
- chrischen 5y agoI don't use React-based static site generators, but I'd imagine if they become slow it's because it's generating a large code-base, but unless you provide some benchmarks showing compilation of React vs some other templating system I can't really take your argument against it for this use case.
- ushakov 5y agodon’t take my word for it https://css-tricks.com/comparing-static-site-generator-build-times/ https://css-tricks.com/comparing-static-site-generator-build... Next.js and Gatsby are the slowest
- TheCoelacanth 5y agoGenerating a bunch of HTML pages from markdown files doesn't seem like a remotely realistic test case for "interactive complex web applications".
- sergiomattei 5y agoYou don’t. Then don’t use it. Nobody’s forcing you to use React. Static site generators are alive and well: Hugo, Pelican, etc.