DEV Community

Discussion on: Dev predictions for 2020

Collapse
 
benbot profile image
Benjamin Botwin • Edited
  1. As you said, svelte is a compiler. A compiler for the svelte language. It compiles svelte code into vanilla js, but what you give the compiler is NOT javascript it's svelte. A svelte file contains markup and some slightly modified javascript within a script tag. Again, I say modified because, as the creator of svelte said in one of his talks, they co-opted the label syntax so we can get that amazing $: syntax. Since much of the established JS tooling will require a bit of extra glue to understand how to translate a svelte file into javascript it's harder to convince those very comfortable with JS and it's tooling that svelte is worth the extra configuration headache.

  2. You're totally right on this.

  3. React and JSX have little to do with each other OTHER than the React community uses JSX. JSX is not React only. React doesn't require, convert, or even understand JSX. Apps that use JSX and React rely on transformers to convert JSX into regular React.createElement calls at build time, but there are other JSX transformers for different frameworks and tools. That process is very different than what goes on with svelte. (not sure for Vue. I never used it) With svelte the entire svelte file gets converted into vanilla assets after going through the svelte compiler. There's rarely a 1 to 1 mapping of svelte code to javascript, but that 1 to 1 mapping does exist with JSX, which is why it fits more nicely into the JS tooling landscape and thus much easier to sell people on.

Thread Thread
 
khrome83 profile image
Zane Milakovic

We can keep debating if you want.

  1. You said it was modified JS and it sounded like you were referring to the output. Thank you for clarifying.

  2. I never claimed react had to use JSX. Calm down. We are all friends here.

Yeah the mapping is a issue. I don’t disagree with that statement. Though I have rarely found a real need for it to map back.

Thread Thread
 
benbot profile image
Benjamin Botwin • Edited

There’s no heat here 😅

Sorry it came off like that. I think I have a tendency to sound a bit combative when I respond to other comments.

As far as JSX goes, you said that react parses jsx, but it doesn’t. All of that work happens at build time by other tools. That’s all I was trying to get at.

And the 1:1 mapping is not usually for the day to day work of application developers, but may be important for tooling developers and those trying to understand the inner workings of their tools.