Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's a common misconception that JSX is XML - that's very excusable as the syntax is based on XML, but it's not the case and you should look into JSX in more depth if you think it is.

However, what's less excusable is thinking React components are somehow equivalent to XML: React components are a lot more than bits of JSX (components very often don't contain any JSX, it's an optional syntax extension, not a fundamental part).

There's very little in common between React components and the XML definitions used by Qt,

> UI with an XML syntax language

If you're interested in learning a bit about how React works, I'll start you off with this: React doesn't really do UI directly at all. It isn't layout-aware, layout is handled by the rendering target: e.g. DOM+CSS for the ReactDOM rendering lib, HTML+CSS for the ReactDOMServer rendering lib, UIKit for the RN iOS rendering lib, etc.



I think the point was that they were declarative and retained mode systems and existed long before react. I'm deeply familiar with React and systems such as WPF/QT and I can see the comparison.


> I think the point was that they were declarative ...

> I'm deeply familiar with React

I'm not trying to be snarky here but... React is not declarative.

Though it's good you highlighted that as that is essentially the fundamental difference here: WPF/QT are declarative, CSS is declarative, UIKit is (mostly?) declarative, HTML is declarative(-ish). React components aren't.


I have to disagree. You produce a data structure representing the UI. That's basically the definition of declarative. Just because you can build that dynamically doesn't mean it is not declarative. You could always build up XML dynamically as well.

It's a far cry from an immediate mode API where you are making draw calls.


A React component is a class or function - there is no static "data structure", except for what any individual dev might define as convention for their own application. Unless we're calling class members "declarative data structure", in which case we may need to revisit some definitions across the programming world.

And it's not really representing UI: that's the main point here. Layout is decoupled; it's only really representing front-end logic and state.


I know what React and JSX were 6 years ago, I understand now it much more complex, I even done React components without JSX and use the React.Div functions to render components.

I liked this about react, you create a render function and render your stuff. It is miles of head or the angular horrible architecture but the Web needs basic components implemented naively that developers can extend and not start every time from Zero with divs and other basic stuff.


Another fun fact about React (at least React Native): there are basically two separate "engines" for class-based and function-based components, with subtle differences.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: