DEV Community

loading...

Discussion on: Dev predictions for 2020

Collapse
benbot profile image
Benjamin Botwin • Edited

I think you’re too optimistic with svelte.

The force react has behind it, and the lack of serious complaints with react itself will make it still the obvious choice for personal projects and products.

While I love svelte, it has a couple of issues when it comes to survival tactics. For one, it’s really it’s own language that embeds a slightly modified form of JavaScript (modified because it abuses the arcane label syntax) which means that a lot of standard tooling in JavaScript land won’t work cleanly with it.

Jsx got around this by being able to translate directly into pretty straightforward JavaScript.

I think it’s more likely that react will eventually (probably not next year) adopt that “Surgical Dom update” idea from svelte.

Collapse
blazephoenix profile image
Tanmay Naik

I think Svelte would be in the place where Vue is right now, maybe a tad bit more popular among new developers because of the easier learning curve.

Collapse
triptych profile image
Andrew Wooldridge Author

That's cool. I am in the camp that lots of different ways of building for the web can coexist, and cross pollination is how things grow and adapt. I mean that's how jQuery influenced the standard JavaScript api of querySelectorAll() etc. I don't think React has to lose if Svelte wins. There hopefully will continue to be innovation and idea sharing between libraries / frameworks. The ultimate goal is that ideas from all these frameworks get integrated at some point back into vanilla JS so that someday we have a robust native way to do these things.

I don't have any illusions that Svelte will dethrone React, but that's because I don't think React has any claim to any throne. Instead, we will see things like WebAssembly and Rust come into play on certain aspects of web development that would benefit from highly optimized and fast code.

So, I'm all for React being popular, and Svelte growing in popularity, but webdev is more than a popularity contest, it's about finding the right tool for the job, and I suspect many more folks will decide to try out Svelte in 2020.

Collapse
khrome83 profile image
Zane Milakovic • Edited

There are a few things I disagree with.

  1. Svelte is a compiler. It’s not react or a JS library. What it compiles too is valid JavaScript. It may not be JS that you would of written, but it is valid. I think saying “slightly modified version of JS” is a lack of understanding. The browser can only run JS. Not a modified version....

  2. I don’t think it has to replace React for it to be successful. If you want to put this in perspective, more sites still use jQuery than React or any other SPA framework today...

  3. Your argument for JSX is not really valid. React parses JSX with JavaScript, as opposed to compiling it. Svelte is a compiler, but everything React does has to be done at run time. This is one of the arguments for Vue over React, in the sense that Vue has a much more practice reality of what it’s doing at run time, because there are less made up conventions.

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.

Forem Open with the Forem app