3 ms·
These days you can use JavaScript-centric stack (and, gasp, React) to render static HTML that does not require runtime JavaScript at all. Why bother with it, t
by strogonoff 1y ago
These days you can use JavaScript-centric stack (and, gasp, React) to render static HTML that does not require runtime JavaScript at all.
Why bother with it, though?
Imagine you wanted to add elements of runtime interactivity. When we think about new and cool things on the Web, that’s nearly all of them. Ask yourself, what would result in more complexity and moving parts: doing the whole thing in one stack (e.g., JavaScript and React), or using two disparate stacks (say, Wordpress and then a bunch of jQuery) and ad-hoc tying them together by duplicating data model and business logic?
The most under-appreciated point about good design is that it’s not just about a thing looking pretty and functioning well at one point in time. It’s about a thing that can be maintained, improved, and kept in good working condition. Good design is sustainable, it exists and satisfies expectations over time.
Good developer experience is not the only aspect of sustainability (there are also cultural/organizational aspects, business model, etc.), but it is an important one. Modern stack is great from this perspective, allowing to express potentially dynamic layout while largely preserving declarativity (JSX), forcing to think about exactly what data you work with at all times so that you catch more issues at compile time (TypeScript), etc.
Yes, it also offers plenty of opportunities for shooting yourself in the foot if you so choose: by carelessly adding random badly maintained dependencies with massive dependency trees, by not thinking through the architecture or piling on abstraction layers, by adopting a framework that does not exactly fit your use case or that you don’t understand how it works, etc. We’ve all done that at some point, but ultimately it’s skill issue. More powerful tools require more thoughtful application.
Yes, sometimes sustainability can compete with the thing’s being pretty or small at one point in time, even though all of those are worthy ideals. Sometimes tradeoffs need to be made.