Hacker News new | ask | show | jobs
by 10xDev 1093 days ago
Reactive declarations that work using syntax outside of JS thanks to the compiler does make it a bit more than just JS. https://twitter.com/youyuxi/status/1057291776724271104
1 comments

Kind of like how JSX is actually JSXScript, sure
JSX is, imho, more akin to a macro; the syntax is replaced with simple expressions. Technically, the JSX syntax isn't even necessary to use React, though most people prefer it.

Svelte bakes itself fully into your code in a way that you can't do without the compiler and still be using svelte.

So you're saying that svelte does not just transpiles to js/css/html ? Could you expand on that a bit more ?
The point is that Svelte is a full compiler- you cannot "use svelte" without it.

JSX is an essential, yet entirely optional, concept in React. The output of the transform is incidental to the actual behavior of React, the library.

As such, I wouldn't think it warrants the term "JSXscript" or whatever the post I replied to used.

Depending on how your tool chain is set up, you don't need a custom file extension like ".jsx" for files that need the transform, and React doesn't care about file extensions at all.

Svelte, on the other hand, pushes you to use the ".svelte" extension, mixing and matching tags, changing scoping rules, and so forth. If you were to write by hand what it puts out, you're not really using svelte anymore. It is, in this sense, elevated itself to a language superset.

I'm not arguing one is better or worse, just pointing out why I think they are sufficiently different to quibble over semantics.

JSX is necessary to use React otherwise you create even more footguns in a library that's littered with them.