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

JSX is XML and it can cause some confusion. For instance the fact that you can only have one root node is not obvious.


I will say though that when it comes to abstracting elements, this behavior seems to be implicit across the board (angular directive templates require the same, though they include a somewhat-informative error state).

As someone who has only begun to feel out React/JSX after developing some large, semi-complex enterprise UI's in Angular (with the respective back-end, usually an abstracted REST API) I'm finding the React model to be a lot more intuitive and scalable.

Angular is fantastic until you run up against problems with complex tasks that either must run outside of the digest loop or require manual control of painting/rendering to compensate for the abysmal binding performance.


It is obvious, because when you use a component, it's usage is as a single root node.

<component /> should not render multiple root nodes.


  return <h2>label</h2><SubComponent />;
That's illegal and will fail to compile and it's not obvious why that should happen.


Because render is a function, and it should return a single value... because JavaScript.


it's very much not XML. it's closest to javascript.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: