Hacker News new | ask | show | jobs
by gerardnico 778 days ago
It does matter.

When you write a gui, you want to think in a tree of component. Ie React.

If you want to print, you think in document (html, …). That’s also a tree by the way.

Html does not have any composability. They try hard to inject that in it (web component, jquery plugin, …)

React (ie virtual dom) is a beauty in this regard and if you don’t use it, you would have a hard time creating any gui with a certain level of difficulty.

4 comments

We were creating many complicated yet great user experience frontends before React was even born, using server side template engines.

React makes development at scale of these things easier, and makes a website really a website (clicks are just triggering javascript instead of the classic post/get cycle that fetches new html). But it is completely unnecessary to build any level of GUI

People did, and do, create guis with very high complexity using desktop technologies, I can assure you we don't need React for that.
I don't agree that you need React or a vdom for composability. I remember a lot of server-side libraries with an API something like

    html(
      body(
        div(
          p("hello world"),
          class: "blah"
        )
      )
    )
where the tree was built using function calls. In such a system, HTML was often represented by an AST (or just a wrapper around a string!) and you could compose HTML together just by creating and calling a function.

This is what JSX/TSX are doing under the hood: they're transpiled to a call to React.createElement. You don't actually need them, though.

> React (ie virtual dom) is a beauty in this regard and if you don’t use it, you would have a hard time creating any gui with a certain level of difficulty

Anyone who didn’t grow up building stuff prior to 2010 would have difficulty.

we don’t need react in 2024. And it’s only making things worse now. Not better.