Hacker News new | ask | show | jobs
by Scarbutt 2453 days ago
Now to be honest, the global idea seems good (static websites built with React)

Out of interest, what's good about building static websites with React?

3 comments

If you're looking at purely static websites, then it's just a way to structure your application; matter of taste, I reckon, and there's plenty of alternatives on the market that go back twenty years if need be. That said, personally I'm quite fond of the component based approach to building websites - and React isn't the only player there.

But the strengths show when you combine it with e.g. Gatsby which turns it into a hybrid website + app. For first time visitors, search engines, and people with JS disabled it's just static HTML, simple. But for most visitors (browsers, JS enabled etc), after the first load it turns into a webapp and any pageview only requires a single .json file to be pulled in, which can be prefetched (on link hover for example) as well. This gives it the performance characteristics of a single-page app.

> what's good about building static websites with React

As compared to which alternatives?

Personally, I find the splitting up of code into components, together with the power and expressiveness of jsx and its closeness to plain javascript, and the simplicity of updating the ui in response to changes of state to be a very compelling argument for react.

I prefer React over any other templating lang I’ve used so far.

Though I never liked Gatsby.