Hacker News new | past | comments | ask | show | jobs | submit login

> The point is this small extension to JS grammar lets you do templating with normal JS, instead of #for you can use .forEach, .map and other array methods.

But then React is much more than just "small extension".

Hooks alone are less of a Javascript than any Svelte template syntax.




We're not talking about React we're talking about JSX.

Svelte has a lot more going on than it's template language as well.

We're only comparing the templating system to JSX.



That's still React. JSX is only turning brackets, tag names, and attributes into function calls and object properties.

Special attributes, events, etc. are React specific and not related to JSX.

Basically it's a clean way to represent nested function calls, that's it. It has nothing to do with React nor does it need React.

<tag prop="value"/> gets turned into React.createElement('tag', {prop: "value"})

That's all. Period. The special props React introduces has nothing to do with JSX.

Also you can customize JSX to change the functions it generates. (i.e. swapping out React.createElement)



Those are all features of React or the React JSX transform, not JSX. Other JSX transforms or frameworks using them may or may not share any or all of them. (JSX is not only used in React.)


Ah. So we're comparing a specific templating language (Svelte) with an idealized and nonexistent version of JSX (JSX is a non-standard extension that has different flavors depending on what underlying framework, and versions of a framework, you use).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: