News for hackers. Stuff that matters.
Re:No CMS? Writing Our Blog in React by robador on Tuesday February 13, 2024 @01:35AM (#39355153)
I think it's great they did what works for them. Personally though, I am starting to believe React, or indeed any reactive framework, is extremely ill suited for most websites. It adds a layer of complexity on many levels that IMHO is not worth the tradeoff. Not only the amount of tooling required (node_modules), also the fact that you're expected to write all your own elements (components) and override default browser functionality, and expect all of that to work perfectly (forever) is baffling to me. React is an extremely complex layer that abstracts away a quite simple and well understood concept: markup. If your content is mostly static, just use markup and sprinkle a bit of js on top of you must. Your visitors will be grateful. If you're building a web based application, which you're probably not, use React.
Re:No CMS? Writing Our Blog in React by davnicwil on Tuesday February 13, 2024 @02:22AM (#39355390)
> just use markup and sprinkle a bit of js on top if you must

My perspective is of React as a templating engine for markup that allows you to add behaviour on top as you need. So in a sense, exactly what you've said.

It's good at this because it's all done seamlessly in the same language with hardly any magic or conventions they have invented. It's just javascript. It also has a rendering model that's extremely simple to reason about when updates happen.

You can build something as complicated or as simple as you want with that, of course, but React doesn't care if you do. That's up to you to decide. React can be 'just' a static markup template engine running at build time (my own blog is built this way!), a server-only template engine, little bits of behaviour sprinkled in on the client to isolated parts of the page, all the way up to a full blown client application with an arbitrary level of complexity.

Re:No CMS? Writing Our Blog in React by gmac on Tuesday February 13, 2024 @03:21AM (#39355674)
I have mixed feelings about React. I like it better than jQuery, and better than most other JS frameworks I’ve used.

But I prefer Mithril (https://mithril.js.org/), which offers the same immediate-mode advantages (https://news.ycombinator.com/item?id=19746235) without the crazy-complex dependency-tracking reactivity.

I rather liked this comment on React: https://news.ycombinator.com/item?id=38640051

Re:No CMS? Writing Our Blog in React by austin-cheney on Tuesday February 13, 2024 @03:17AM (#39355646)
Agreed. This a problem that only needs to be solved once. My personal website is an OS like GUI that took a fair amount of effort to extract from an unrelated application, but no greater effort than starting from scratch with something like React. That effort is over and future contributions are now little more than a line of text in the HTML but I get all the flexibility and performance of not using React.
Re:No CMS? Writing Our Blog in React by maelito on Tuesday February 13, 2024 @02:20AM (#39355385)
> If your content is mostly static, just use markup and sprinkle a bit of js on top of you must. Your visitors will be grateful. If you're building a web based application, which you're probably not, use React.

This is solved by React server rendering or RSC, e.g. through Next.

Your visitors will see HTML.

Re:No CMS? Writing Our Blog in React by bilekas on Tuesday February 13, 2024 @02:28AM (#39355424)
> This is solved by React server rendering or RSC, e.g. through Next.

You realise that's just HTML with more steps?

Re:No CMS? Writing Our Blog in React by arvinsim on Tuesday February 13, 2024 @04:12AM (#39355925)
HTML doesn't solve routes as well as markup reuse. If you want to copypaste markup into it's own HTML and edit the contents, then you do you.
Re:No CMS? Writing Our Blog in React by reactordev on Tuesday February 13, 2024 @04:20AM (#39355973)
<template> is completely reusable…
Re:No CMS? Writing Our Blog in React by maelito on Tuesday February 13, 2024 @02:16AM (#39355365)
> the fact that you're expected to write all your own elements (components) and override default browser functionality

What ? I've certainly not overriden the HTML div, nor the CSS font-weight.