r/javascript • • Jan 15 '21

Svelte beats react for developer satisfaction in 2020

https://2020.stateofjs.com/en-US/technologies/front-end-frameworks/
346 Upvotes

231 comments sorted by

326

u/moufoo Jan 15 '21 edited Jan 16 '21

Sure, because it's the hot new kid on the block.

Fewer people are using it (check the stats) and most are still in the honeymoon phase. Let's see if it can maintain a satisfaction level on par with React when it reaches the same volume of users.

I don't mean that Svelte is bad. On the contrary, I really advise you to check it out (the getting started is amazing). But please be wary of statistics

66

u/dmethvin Jan 15 '21

Hey, 4 out of 5 developers prefer React for their clients who use React.

-5

u/[deleted] Jan 16 '21

That’s mainly because of the debt.

6

u/[deleted] Jan 16 '21

Debt and whoosh.

-2

u/[deleted] Jan 16 '21

Exactly! 🤞🏻

28

u/Pesthuf Jan 15 '21

The F# effect.

12

u/Attila226 Jan 15 '21

I never heard anything bad about F#.

51

u/brie_de_maupassant Jan 15 '21

Gee, flat is how I feel about it.

1

u/Silhouette Jan 16 '21

Ouch. Looks like someone's losing their temper!

0

u/[deleted] Jan 15 '21

[deleted]

23

u/fgutz Jan 16 '21

This is the 7th minor comment I've read about this

19

u/asukazama Jan 16 '21

It's a key discussion

0

u/[deleted] Jan 16 '21

[deleted]

13

u/schm0 Jan 16 '21

Compose yourself, this is a common melody that can result in key changes, as I'm sure you'll note.

7

u/Disgruntled-Cacti Jan 15 '21

F# is great though

13

u/droctagonapus Jan 15 '21

I mean, F# is not new anymore lol. It is still much nicer than C# though :)

3

u/PM_ME_HAPPY_DOGGOS Jan 16 '21

Damn, and I thought C# was pretty nifty

1

u/Beneficial_Toe_2347 Oct 30 '21

C# .net core is king

0

u/[deleted] Jan 16 '21

[deleted]

2

u/Pelicantaloupe Jan 16 '21

McDonald’s is addictive trash though?

7

u/editor_of_the_beast Jan 15 '21

Why do I feel like you were the exact person 5 years ago talking about the satisfaction level of React?

4

u/toi80QC Jan 16 '21

Been using Svelte whenever I could for the past 2 years.. unfortunately lots of projects with bigger teams are still forced into React, Angular, or lately webcomponents.

I'd argue that webcomponents are the real new hot shit these days.. and pretty much overhyped imo.

3

u/troglo-dyke Jan 16 '21

I always take these kinds of stats with a pinch of salt. Most people doing FE work are using React for work, then might play around with other frameworks/libraries in their spare time. Surveys like this don't account for the fact that for most people who have used both React + something else, will usually rate the 'something else' higher because they're smaller "toy" projects

13

u/davidwparker Jan 15 '21

100% this for sure.

Personal anecdote: using Svelte for almost a year now, previously used React for multiple years. I won't be going back to React (or Vue, or Angular, or ...). Svelte is just much nicer to work with.

5

u/portexe Jan 16 '21

I’ve always wondered how state management worked in svelte. I may have to learn it to find out.

8

u/rickt3420 Jan 16 '21

Svelte stores and once you work with them you’ll quickly see it’s by far the easiest and best state management out there.

8

u/Oalei Jan 16 '21

Svelte looks similar to Angular to me, or maybe it’s just the templating engine?

5

u/davidwparker Jan 16 '21

It's all-in-one file (CSS+JS+HTML, similar to Vue).

It's compiled ahead of time, and doesn't use a virtual dom.

Ultimately, after being built/etc, it results in extremely small + fast files.

There's definitely some quirks to it (as there is anything), but even when I have issues, I can generally resolve them extremely quickly.

4

u/Oalei Jan 16 '21

Angular can also be « all in one » if you want it to be (and imo it’s a bad thing to have everything in the same place).
Angular also has AOT compilation.
Svelte doesnt have a virtual dom yet you shouldn’t manipulate the dom directly because svelte has its own internal state of the dom (very much like a virtual dom, but not for the same purpose)...

6

u/davidwparker Jan 16 '21

Hm- it's hard to explain it within the context of Reddit, so I'll let the author do so: https://www.youtube.com/watch?v=AdNJ3fydeao

Svelte isn't going to be, nor does it need to use a virtual DOM.

Also, the size is tiny. My site's total JS transferred is ~96kb uncached. Most Angular sites are much larger in file size.

As far as all-in-one goes, between Svelte + Tailwind, I've never been more productive, and everything being componentized makes re-use better than ever with the smallest possible footprint.

Edit: to me, it's sort of like Tailwind. I didn't get it / like it until I tried it for a substantial project. Just glancing at videos / doing the tutorial didn't really grok how good it was. Once I built something larger in it, it really shined.

2

u/Oalei Jan 16 '21

The talk was nice, thanks for the link.
I wonder how the $: operator works for array pf objects, does it just check if the reference is the same, or does it do a deep equals comparison to see if the value changed?
With his talk I didnt get if $: was implemented by Javascript or by Svelte and its own compiler

2

u/DoomdDotDev Mar 06 '21

I have a very large site running Svelte (converted from React) that is almost exclusively powered by reactive arrays. FYI, I developed with React for two years.

I use Svelte stores to store large arrays of objects fetched from the API server as users move around a custom map. All client facing data uses "derived" values to filter those stores automatically (for de-duped markers on a map or if the user chooses additional filters to reduce the list of "card" items etc).

Large arrays are indeed reactive with the $ either as stores you subscribe to...or as local variables you want to make reactive. Svelte has saved me countless hours over the last year (and really is way faster and smaller than most equivalent react apps). Now with snowpack, development is even faster with near instantaneous hot reloading. I highly recommend it...and frankly, I would refuse jobs in the future if they didn't allow me to develop using Svelte. They'd be fools to pay me to develop with react anyway...because I get Svelte work done in about 2/3rd the time...no joke.

1

u/davidwparker Jan 16 '21

I think it's within the Svelte compiler, but I don't know the internals (I've watched a couple of talks but don't recall).

1

u/ryan_solid Jan 17 '21

It's compiled. The component is the observer so they use assignment syntax to basically compile in re-render triggers. In basic they don't do any checks at that point. However, they have template helpers for handling lists so when our updated list re-runs there they can do a shallow diff by key or index.

1

u/[deleted] Jan 16 '21

Would you recommend Svelte for creating third party widgets?

1

u/[deleted] Jan 16 '21 edited Jan 16 '21

Ultimately, after being built/etc, it results in extremely small + fast files.

depends on the project size. on larger projects, the svelte bundle size gonna be larger. https://raw.githubusercontent.com/halfnelson/svelte-it-will-scale/master/img/Source%20size%20vs%20Bundle%20size.svg

0

u/[deleted] Jan 16 '21

[deleted]

0

u/[deleted] Jan 16 '21

[deleted]

18

u/dzkn Jan 16 '21

If you think a virtual Dom doubles the work then you don't understand what it does. It was introduced to improve performance, and if it didn't it would be removed.

0

u/[deleted] Jan 16 '21

[deleted]

9

u/dzkn Jan 16 '21

Updating the actual dom is very inefficient because it triggers lots of repainting in the browser. Nothing stops anyone from making a react that manipulates the dom directly, but we don't because it performs worse.

Svelte manipulates the dom directly and efficiently, but has it's own tradeoffs.

12

u/csorfab Jan 16 '21

it doubles the work

no it doesn't. operations on a VDOM are much much faster than operations on the actual DOM. Also, it's not "re-applying the same changes again", the VDOM is used exactly for diffing the rendered subtree to the current state so that the number of actual, costly DOM update operations can be minimized. VDOM operations are as cheap as they get.

Svelte is nice, sure, but for most real world use-cases, it's not really that much faster than React.

7

u/dzkn Jan 16 '21

Exactly. 99% of the time you run into performance issues with vue or react, you made a mistake. You would have make many thousands changes every second to hit the limits of the vdom approach.

→ More replies (6)

4

u/[deleted] Jan 16 '21

I don't think you understand just how slow the DOM really is

→ More replies (3)

1

u/gg363 Jan 30 '21

Any downsides? Have you used it in real-world/enterprise apps or just hobby projects?

1

u/davidwparker Jan 30 '21

It's a real-world project (you can see it if you check my comment history). Traffic isn't huge (450k requests in the last month), but given that I haven't marketed it, it's doing fine.

WRT "developer satisfaction" since I'm the only one working on it, that makes it easier/nicer to work with too, just because I can do whatever I'd like.

1

u/gg363 Jan 31 '21

Nice looking site. Congrats on the traffic, that's far from trivial.

11

u/bumbershootle Jan 15 '21

Less people are using it

https://i.imgur.com/6gRZd00.jpg

-4

u/Emjp4 Jan 16 '21

I think the typo fix OP would have preferred is lesser*

1

u/posts_lindsay_lohan Jan 19 '21

New thing always better than old, boring, stable thing. /s

The worst part of Svelte is the name. Every dev I've met has a hard time saying it.

0

u/[deleted] Jan 15 '21

[deleted]

5

u/format71 Jan 15 '21

I wonder though - all those people not answering the survey - I bet quite a few of them are buried in enterprises writing angular code, not even knowing what they’re missing.

I pity all being forced to write angular code in their job. Me included.

6

u/[deleted] Jan 15 '21

I felt that way until I got like a year in... it’s pretty alright tbh. Maybe I’m just at the stage In my career where I value productivity over cool stuff. Shit just works, it’s pretty fast to develop in, Its easy to onboard new people, and the team seems to be trying to stay modern. It’s been a while but last I heard angular plays better with web components than react for example.

5

u/Oalei Jan 16 '21

Huh? What’s wrong with Angular?
You think you can’t do clean code when using Angular? (Not talking about angularjs the dinosaur)

1

u/format71 Jan 16 '21

Of cause you can write clean code in angular.

My two main problems with angular - or things I like a lot more with react - are

  1. While react is more or less just plain JavaScript, angular has a lot more ‘magic’.

  2. My preferred way of learning is to understand. It took me just a couple of talks on YouTube to get the full understanding of how react works. People are reimplementing react-dom in an hour on stage. Same with hooks. Takes only 20 minutes to make your own implementation from scratch. And by that all magic is gone. It’s just JavaScript and good code. Angular on the other side.... I did read a book on reimplementing angularjs and that explained a lot. Made it a lot easier, but then came angular witch is just a huge pile of magic and unicorns and nowhere is there anyone on any stage saying ‘let’s just reimplement angular on stage, cause it’s that easy’.

But of cause - people are different. But it seems like there are a lot more people agreeing there are better things then angular out there, so it can’t just be me..

-3

u/[deleted] Jan 15 '21

[removed] — view removed comment

7

u/Reashu Jan 16 '21

Student code usually isn't a great example.

2

u/format71 Jan 16 '21

And in my experience, this makes developers skip breaking things up, cause its just a burden. All the exporting and registrations and exposing and providing and... nope. Let’s just have the whole screen as one component instead.

1

u/[deleted] Jan 16 '21

[removed] — view removed comment

1

u/format71 Jan 16 '21

I like react better than angular. There is nothing to argue about. 😜

1

u/Oalei Jan 16 '21

I feel like you just don’t know Angular, your username checks out

27

u/andrei9669 Jan 16 '21

Contrary to popular belief, reason why I like React is cus of jsx.

9

u/ck2fan Jan 16 '21

I don't really get why people dislike JSX.

4

u/andrei9669 Jan 16 '21

Yeah, me neither. My only guess is that it looks/behaves differently to traditional html. And for some reason, people just dislike it. Honestly, I kinda get where they are coming from. Cus I started from react, like before doing traditional html/css, I just jumped straight into react and felt like I was at home. Now, if people show me angular or vue I'm like... Ugh.

3

u/De_Wouter Jan 16 '21

Really? It's probably what I like least about React, well that and it's origin...

15

u/andrei9669 Jan 16 '21

and the fact that I don't have to use library-specific props like "v-for" and such. dunno, something about those just rubs the wrong way.

and don't get me started about string specific strings in those props, like
v-for="(value, name, index) in object" if you don't have ide support, good luck with typos.

2

u/[deleted] Jan 20 '21

I mean you can always use `React.createElement` directly without JSX.

97

u/switz213 Jan 15 '21

"beats"

89% to 88%, a rounding error that doesn't even take into account scale. what a dumb clickbait headline.

0

u/[deleted] Jan 16 '21

[deleted]

8

u/MadCervantes Jan 16 '21

Nobody is.

39

u/Vheissu_ Jan 15 '21

Has anyone actually used Svelte on a large LOB application or just on smaller apps? Because, while the examples might look impressive what happens when you throw in a few Node packages, start writing CSS, throw in images, routing and other facets of modern apps.

Don't get me wrong, I think Svelte is cool and I wish it well, but is anyone actually building anything substantial with it yet? I haven't seen any larger success stories shared about it (or maybe I just haven't looked properly).

24

u/eternacht Jan 15 '21

My company just re-wrote one of our main apps in Svelte (SaaS in the biotech space). I haven't worked on it personally but I've heard nothing but praise for the framework and how easy it is to implement features with it compared to React. I have heard complaints about the complexity of setting up the associated dev tooling (e.g., hot-module reloading), though that may be in part due to our very specific back-end setup.

15

u/texmexslayer Jan 16 '21

Svelte Kit might help with that, open beta coming soon

6

u/rk06 Jan 16 '21

I think "compared to react" is key part here. fans of preact, vue etc also say the same

2

u/Nipinium Jan 16 '21

I'm using svelte-loader-hot for HMR. Kinda works.

2

u/Vheissu_ Jan 16 '21

That's great to hear. I agree on the complexity of React. I remember jumping on React in 2014 and after using AngularJS, I was excited about the future of front-end again. I haven't worked with React in a few years until recently, and honestly, it felt unrecognisable to me. I know JavaScript quite well, but React definitely has a learning curve that is steeper than React of 2014. A lot of the complexities seem to exist purely to address's architectural shortcomings in React itself (class components and hooks, Virtual DOM).

I have heard great things about Svelte too and I think competition is good as well. For a project relatively young in comparison, Svelte is very promising.

6

u/DasHesslon Jan 16 '21

Im not part of the project but chess.com is built with svelte which is the first time i spotted it in the wild

5

u/kbradl16 Jan 16 '21

I’ll be all in when svelte kit comes out. The dev experience is worth any production struggles I’d run into. I’ve built a few small apps with svelte but stopped on important projects because of sapper not being up to snuff and the lack of typescript support at the time too.

3

u/Auxx Jan 16 '21

We just rewrote Svelte POC into Angular. Svelte didn't seem fit for large apps. Quick POCs - yes, big products - no.

1

u/Doctor-Dapper Jan 16 '21

Are that many people making large apps anyway? I thought micro frontends distributed by CDN were the next big thing

1

u/SomeRustJunkie Jan 16 '21

Yes. It’s so easy to integrate and library with it, all JS works out of the box. I’ve built many apps in production and the experience is some of the best DX for JS. Lee’s code, faster apps, is brilliant.

1

u/posts_lindsay_lohan Jan 19 '21

Speaking of css, does Svelte have a way of handling styling that works as well and is as intuitive as styled-components?

0

u/[deleted] Jan 16 '21

[deleted]

2

u/[deleted] Jan 16 '21

Obviously those kind of benchmarks are always hard to get.

https://github.com/halfnelson/svelte-it-will-scale

1

u/willy_teee Jan 17 '21

Thanks, I was looking for this after listening to the podcast!

32

u/[deleted] Jan 15 '21

Svelte is awesome tho. I really hope it continues to gain traction. I very much prefer it to React.

3

u/yeahdixon Jan 16 '21

Though I have not learned enough but svelte , I am a big fan of simplicity. It may seem obvious to say this but people seem to lose their way. They find a couple of reasons to make things complex to solve some arbitrary issues and or edge cases. This does solve those issues but starts down the slippery slope of complexity. How much is worth that millisecond of improvement to push the boundaries a bit further?

41

u/AuroraVandomme Jan 15 '21

Sadly no matter how good any other framework will be, React would still cover 80% of job offers for like 20 years :/

52

u/TheSaasDev Jan 16 '21

To be honest I'm happy that the JS ecosystem has settled a little bit, instead of constantly changing it up with new frameworks

17

u/meeeeoooowy Jan 16 '21

Seriously, when vue came to out people acted like if you didn't switch to that you were going to be left behind in legacy world as it was soooo much better

I'm glad they were wrong and we could chill for a bit

-5

u/yeahdixon Jan 16 '21

You should still reconsider vue .... I’m still heeeere

3

u/ryan_solid Jan 16 '21

A large number of people feel this way. But it's not like it stops moving. People just get off the bus. Which is probably a good thing.

I think Server Rendering is going to be an even hotter topic this year with frameworks vying to get the regular website developers as well.

0

u/[deleted] Jan 16 '21

[deleted]

1

u/ryan_solid Jan 16 '21

Almost every framework is working on solutions in this area right now. And theyve been doing so for about the last year and a half. Some already have them have already shipped async server rendering. It just takes React shining the light for people to see the importance. Watch this space in 2021.

0

u/[deleted] Jan 16 '21

[deleted]

2

u/ryan_solid Jan 16 '21

Yeah thats the thing and it's fine. If React can stay ahead of the need there is no need to look elsewhere. Since React sets the narrative as well its basically irrelevant if other solutions get there first even by several years or offer only slightly better solutions or do both.

1

u/[deleted] Jan 17 '21

This is true. Server side rendering has been baked into Angular for several years now and hasn't gotten a whole lot of fanfare

21

u/Zerotorescue Jan 15 '21

What country? React being the majority would be a dream come true.

9

u/snejk47 Jan 15 '21

What country are you in?

3

u/AuroraVandomme Jan 16 '21

Europe in general.

3

u/xroalx Jan 16 '21

Angular is very much preferred in corporate, though. At least that's the impression I'm getting from central Europe jobs.

2

u/AuroraVandomme Jan 16 '21

You are right, mostly in banking systems. But 80% of job offers I'm getting are react related. I am react dev but would love to write in svelte.

2

u/icsharper Jan 16 '21

Can confirm. Massively used in Europe, along side with React. Also Flutter getting some traction as well.

0

u/[deleted] Jan 15 '21

[deleted]

-4

u/E_R_E_R_I Jan 16 '21

Yes but most of the internet is still php.

7

u/ejfrodo Jan 16 '21

True, but probably >90% of the sites you visit aren't

1

u/Doctor-Dapper Jan 16 '21

Why are you bringing up php in a react thread?

0

u/[deleted] Jan 16 '21

[deleted]

2

u/rk06 Jan 16 '21

.net is backend and react is frontend tech. perhaps you are not filtering out backend jobs

4

u/[deleted] Jan 16 '21

Nah that's too long in the JS world.

3

u/elingeniero Jan 16 '21

Could be worse! React may have lost its sheen but it is still really nice. Without it we'd all have to use angular...

0

u/[deleted] Jan 16 '21

It's good that in my country most jobs are angular. There is nothing worse than react redux projects without typescript. Just horrible.

-12

u/watanashi1 Jan 15 '21

I think you are right. React is the WordPress of the JS world.

36

u/onesneakymofo Jan 15 '21

Nah, that would be jQuery

0

u/[deleted] Jan 16 '21

[deleted]

12

u/mihirmusprime Jan 16 '21

You shouldn't need to pick up JQuery in 2021. JQuery was needed when equivalent in vanilla JS was difficult or tedious to do. Today, it's simpler to perform those same actions in vanilla JS. For DOM access, you can just use querySelector and for requests, you can use Fetch.

-1

u/i_ate_god Jan 16 '21

if you're not using any frameworks at all like react, vue, or svelte then I'd always reach for jQuery, because just because the DOM API can do what jQuery can do, it doesn't mean it can do it in a pleasant way.

$('#hide-btn').click(() => $('.stuff').hide());
$('#show-btn').click(() => $('.stuff').show());

vs

document.getElementById('hide-btn').addEventListener('click', e => {
  document.querySelectorAll('.stuff').forEach(el => el.hidden = true);
});

document.getElementById('show-btn').addEventListener('click', e => {
  document.querySelectorAll('.stuff').forEach(el => el.hidden = false);
});

I wouldn't use jquery for http requests over either fetch, or the also more pleasant to use, axios library mind you. But for regular dom manipulation, jQuery is about as pleasant of an experience as it can get.

3

u/onesneakymofo Jan 16 '21

Two things though. By depending on jQuery, your codebase falls further behind modern Javascript, and you're now learning jQuery instead of vanilla JS which is what companies care about.

You can always wrap things like you posted in functions so it's not overkill to type every time.

2

u/[deleted] Jan 16 '21

if you're not using any frameworks at all like react, vue, or svelte then I'd always reach for jQuery

In other words, you shouldn't need to pick up jQuery in 2021.

0

u/honeybadgerUK Jan 15 '21

Yeah because enterprise companies all over the world use WordPress.

-6

u/snejk47 Jan 15 '21

So what? WordPress is just quick to setup and easy to use but security wise it's not "the best" option... React has proven itself and doesn't have bad reputation.

5

u/SomeRustJunkie Jan 16 '21

Most people that use svelte realize how much of a step forward it is in DX, simplicity, and power compared to other frameworks. It feels like an evolution of web development tooling, and a much needed extension of JS as a language.

30

u/_Pho_ Jan 15 '21

As a React professional who hasn't touched Svelte, what can Svelte possibly do to be any better? I don't want to sound like a fanboy, but I feel like React + Suspense + Recoil or Context is pretty much the endgame for front end. What else could it possibly be missing?

29

u/frankandsteinatlaw Jan 16 '21

React makes animations 10x harder / more annoying than they should be. With hooks it’s really easy to fuck up a large app by not memorizing some function coming from a common hook / other similar dependency array issues. Hooks have odd rules that make code with them less pleasant than it could be (think rules of hooks lint rules). React isn’t performant by default in many cases, and even when you patch up the perf leaks it’s really easy to open them back up again. Function components lead to more freedom of code placement, which means code is just less easy to parse codebase to codebase. React leaves a lot of important decisions up to the dev around routing, styling, etc, which is nice in some ways, but in other ways means more work and less standardization. These are off the top of my head.

I’ve been working with react for years and it’s got great core ideas (view is a function of state), but it feels far from an endgame when dealing with all real world app cases.

You should try svelte and see how it feels. It’s also not perfect, but you might find some interesting advantages and disadvantages that will help you gain some perspective.

11

u/qudat Jan 16 '21

Agreed. As much as hooks have simplified component development and abstracting reusable logic, the rules are annoying and it’s so easy to miss something and get stuck in an infinite loop.

I’ve been using react for 5+ years and still love using it, but I’m feeling like we’re going to see a new paradigm emerge that solves the problems we have with react.

3

u/brainless_badger Jan 16 '21

I see this criticism frequently, but infinite loops have been a complete non-issue for me and my team since switching to hooks.

IMO, if you are running into infinite loops frequently you are either not using react's eslint plugin to figure out dependency arrays for you, or you have wrong mental model for derived state (i.e. setState calls in useEffect).

6

u/frankandsteinatlaw Jan 16 '21

I work on an app with 200+ devs of varying skill levels. It’d be nice to not need everyone to understand the non-obvious intricacies of react.

1

u/qudat Jan 16 '21

I get what you’re saying, these infinite loops we run into rarely make it into production, however, hooks dramatically increase the probability of hitting infinite loops in development as compared to class components.

It is an issue and one that will crash your browser.

5

u/andrei9669 Jan 16 '21

I mean, if you have solid eslint rules, and you know basics, it's hard to fuck up.

→ More replies (10)

0

u/yeahdixon Jan 16 '21 edited Jan 16 '21

Hooks shmoooks.

Btw Vue has a single callback called nexTick that makes programmatic animations a lot easier on vdom.

I’m stunned react doesn’t have the same. If it exists someone please let me know, it’s killin me

1

u/frankandsteinatlaw Jan 16 '21

Yeah, a lot of react animation code ends up being changing classes with somewhat specific state updates.I haven’t used view but if the idea around nextTick is allowing for default states to exist before moving to the animated state that does sound nice

2

u/yeahdixon Jan 16 '21

Yes it’s handy to say the least. Say you want to fade in a menu immediately after you toggle it on.

showMenu=true // renders menu to the DOM

nextTick(()=>{

let eleContainer = container.querySelector(“.menu”)

// now fade menu or do whatever you want

tweenlib.to(eleContainer, {duration:1.0 ,opacity:1})

})

1

u/frankandsteinatlaw Jan 16 '21

Ah yeah, that seems nice.

4

u/andrei9669 Jan 16 '21

So in essence, we need a dev dependency that would make react oppinionated? Nextjs?

2

u/frankandsteinatlaw Jan 16 '21

As a curious dev, I do enjoy the way React allows good standards to form overtime by not trying to figure it all out and ship it at once. But when you just want to get shit done from 0 you still have to make a bunch of choices.

Though this isn’t a huge problem for me at this point, it’s certainly a barrier of entry for folks newer to the FE ecosystem.

Frameworks like Next definitely alleviate this to some degree, though Next isn’t your only choice when it comes to batteries included React frameworks.

1

u/andrei9669 Jan 16 '21

I guess it's a curse and a blessing. but as you said, structuring your project comes with experience. at first, I didn't know what should be where but by the third project I got the gist of it.
But I must agree, there should be at least some basic level structure that would be agreed upon between all developers and could be "the standard" I mean, there kinda already is tho, code goes into src and components go into components directory.

As long as grouping of code makes sense, it's not that hard to get accustomed with the new codebase. now, if code is all over the place, good luck with that.

8

u/SomeRustJunkie Jan 16 '21

Svelte does everything better. Reactivity, no boilerplate, built in (and better) state management, built in animations, free easy interop with third party libs, no boilerplate, actions, await blocks, etc. You can always write the same apps with less code, because the defaults are more powerful. Also smaller bundles.

1

u/hylomorphizm Jan 19 '21

Svelte is a great framework. The only other framework I consider competitive with Svelte is Solid, mainly because Solid is so freaking fast. Solid has a babel plugin to transpile their special reactive js/ts into vanilla js, so they end up taking a similar approach to Svelte.

1

u/SomeRustJunkie Jan 20 '21

Yea I’ve checked out solid briefly but I was a bit turned off by the syntax. I was worried that it didn’t have the same minimal syntax / optimal dx / 0 boilerplate system that svelte has. Are you familiar enough with both to speak on that relationship?

20

u/evert Jan 16 '21

There's lots of complaints from hardcore React devs about suspense. I won't repeat their arguments, but if you don't see negatives with suspense, you probably are indeed a fanboy.

6

u/epukinsk Jan 16 '21

Can you link some? I'm not finding anything anything on Google. Or just give me some keywords to search for on what people don't like about it?

7

u/evert Jan 16 '21

9

u/aniforprez Jan 16 '21

I feel this with all major front end frameworks. Every single one of them right now is cobbled together with hacks and workarounds because the standard library is woefully sparse and basic functionality needs to be rewritten every time. I look at the source of react and Vue and want to vomit though at least they're all in on types which at least affords some understanding

The source of back-end frameworks like rails and django is so readable you can implement any functionality they provide again yourself. Not so with these frameworks and that's absolutely terrible

7

u/evert Jan 16 '21

Backend is relatively speaking so incredibly easy though. Handling a request can basically be done in a single thread. Very easy to see and predict in what order code will run. It's just a request that generates a response.

On the frontend you're dealing with pesky humans and events, which means many different application states are possible and you can't really predict in what order your code will run, no matter what you do.

In the almost 2 decades I've done this, I've never seen people particularly happy with structuring code for complex GUIs. I think we're still seeking for a better paradigm, but I despite React's issues, I think it's a fantastic attempt at it.

I don't think React is it, but I think it's a prominent part in the history of this story, and we'll talk about it years later. Svelte and Vue might do some things better, but they're incremental steps.

Hooks completely blew my mind, but they're also fucking weird. Both simpler and incredibly hard to reason about.

3

u/ryan_solid Jan 16 '21

I think because Hooks are a borrowed solution to a problem retrofitted on basically the complete opposite paradigm. The fact they work is genius. Svelte and Vue basically have the fixed version (actually the original version but it took React to make them a thing for other frameworks to know how to market them).

But that's the thing at this point it is all incremental. Interestingly enough it takes fairly large evolutionary changes to improve of what React has done while maintaining a solid base. But it's challenging because all that effort is seeing diminishing returns.

0

u/[deleted] Jan 16 '21

[deleted]

1

u/format71 Jan 16 '21

I disagree. Not understanding the abstraction you are using - or even what it abstracts - makes it hard doing the right stuff. Taking the right choices. And especially when things don’t work out as expected; I’m spending so much time with colleagues helping them out of trouble because they never take the time to learn what’s under the hood. So to me, it’s very much important to understand what’s under the hood. And if the framework makes it hard to take a peek under the hood, it’s not a framework for me.

0

u/[deleted] Jan 16 '21

[deleted]

2

u/format71 Jan 16 '21

I think maybe it’s the way my brain works. Of cause I don’t know and understand ever single area of the frameworks I use, but still... I don’t like ‘fill in the blanks’ development where I get a spot to write my code and cannot see or understand what keeps the parts together.

0

u/jabarr Jan 16 '21

Let’s not forget if you leak a native element it leaks your entire layout as well, since the fiber node tree is just a big connected graph. For those who don’t know, everyone unmounting an input element has a leak in their React application right now thanks to a chromium bug :)

9

u/gustavo_pch Jan 16 '21

It's incredibly easier to do animations, transitions, state management and some other things in Svelte. Try their tutorial in the official site and you'll quickly see what I'm talking about.

0

u/[deleted] Jan 16 '21

[deleted]

1

u/gustavo_pch Jan 16 '21

I haven't used Svelte in a serious project yet, but I don't see how those advantages in DX wouldn't apply to a large project. Actually, I'm pretty confident that Svelte would make me more productive in a large project as I get to write less to achieve the same results.

Just check how you can write a masked input that doesn't loses the cursor position as you type (https://svelte.dev/tutorial/tick) or how few lines you need to add spring animations (https://svelte.dev/tutorial/spring). Those are not trivial things, yet Svelte makes them trivial.

0

u/[deleted] Jan 16 '21

[deleted]

1

u/gustavo_pch Jan 16 '21

So you're saying that with Svelte it would be harder to have a lot of files in sync? What exactly do you mean with "in sync"? I mean, Svelte is component-based just as React is. So why do you think Svelte would do a worse job on that regard?

Well, you don't like the syntax. That's fine. I also like how React leverages all JS features.

BTW have you checked the links I provided? Didn't you find impressive how easily those things can be done in Svelte?

1

u/[deleted] Jan 16 '21

I meant 'in sync' as in forming a large, cohesive project that is easy to refactor, add features to, etc. Because of React's base being functions instead of xml, there is a large interface for doing this. Svelte has a much smaller interface and lacks basic features such as prop typing.

4

u/ryan_solid Jan 16 '21

Better performance, smaller size, and a cleaner model. React does pretty much have it all though. We are talking about things that are seen as only incremental improvements. Whereas will take complete evolution in approaches to see tangible gains in all these areas.

3

u/i4mn30 Jan 16 '21

State management is a bit complicated in my opinion. I hate hooks.

1

u/_Pho_ Jan 16 '21

Check out Recoil!

1

u/toolazytofinishmyw Jan 16 '21

they have a good video comparing performance in the svelte website. there are 2 major differences. svelte is a compiler that generates vanilla js at build time, no framework is shipped to the client. it doesn’t use a shadow dom, rather it uses forward references to determine updates, which is more efficient.

14

u/Driezzz Jan 15 '21

Never used Svelte, so i'm interested. But tbh, the stateofjs is just a popularity contest.

20

u/[deleted] Jan 15 '21

Is popularity contest another way to say opinion survey?

4

u/yesman_85 Jan 16 '21

I like svelte, the tooling is a little wonky here and there. It does differ from single developer syndrome though. Hard to convince management to switch to a framework with no actual corporate backing, like angular and react.

3

u/desmap Jan 16 '21

2

u/brainless_badger Jan 16 '21

Yeah, smaller libs seem to have grossly overestimated usage in this poll, when compared with npm or stack overflow stats. Not only Svelte.

3

u/TryallAllombria Jan 16 '21

I already started some personal projects with React and Vue. And I personally prefer Svelte. It's way more simple to prototype things.

The only thing I don't like is the store system that have some weird syntax that prove they didn't thought about every aspect of their system.

5

u/counterfreight Jan 16 '21

When you have 3/3 people responding yes for thing A, and 600/1000 people responding yes for thing B, thing A will have a higher satisfaction rating.

11

u/[deleted] Jan 15 '21

I refuse to learn another js buzz stuff!

3

u/Doctor-Dapper Jan 16 '21

Until it becomes industry standard and you have to if you want to get access to the best jobs.

Not saying svelte will but you need to have that "always learning new stuff" attitude to be a flexible developer

5

u/am0x Jan 16 '21 edited Jan 16 '21

Oh you know another.js?

We used to have a drinking game where we would come up with a noun or verb and see if it was a repo in GitHub.

You’d be surprised. We drank more than you’d think.

1

u/[deleted] Jan 16 '21

😂😂😂🤣

2

u/[deleted] Jan 15 '21

[removed] — view removed comment

0

u/AutoModerator Jan 15 '21

Hi u/toastertop, this comment was removed because you used a URL shortener.

Feel free to resubmit with the real link.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

7

u/malicar Jan 16 '21

I've heard of it but never used it, I'm liking vue best so far

4

u/am0x Jan 16 '21

Oh yea. It’s a baby. Meaning early adopters love the idea, but the eventual execution will be different.

For example, Laravel was the Symphony replacer for php. For years it has been referred as the best.

But then, oh no, people are starting to say that symphony is better again!

Then WordPress, the red headed step child of Content Management Systems was absolutely destroyed by the new CMS’s!

Except it wasn’t...it releases a default WYSWYG with a headless option, and the only real contenders now cost $250+ a month compared to their, well, free tier. Devs have to live in hell just a little bit longer.

I was honestly surprised even Vue survived the birthing process, but after using it, I loved it. Granted, I haven’t used Angular since before the paradigm shift, but I just can’t get on board with it. React is essentially becoming the new jQuery except I’d has cross mobile experience which is a plus.

I get why JSX is cool and works, but I feel like it is a symptom of a bigger overall FE issue.

Anyway, I just kind of want to avoid FE dev these days, it’s like the 80s but with more std’s(npm’s)

5

u/MonkAndCanatella Jan 16 '21

Of course it is. I've used Svelte and it really makes React feel antiquated. I wish our company used Svelte.

2

u/elcapitanoooo Jan 16 '21

Does svelte support TS? Last time i checked the templates had no support at all. Maybe this has changed.

2

u/maplefactory Jan 16 '21
npx degit sveltejs/template sveltetest
cd sveltetest
node scripts/setupTypeScript.js

Boom you've got a TypeScript Svelte template. That script adds the TS configs, etc, and then removes itself.

1

u/cmdr-William-Riker Jan 16 '21

Hoping to use it in production applications in a few years after it stabilizes. It looks really promising and beautifully light weight and clean compared to React and Vue, but it is still new and drastic changes seem to be occurring often within the ecosystem (in particular the creator of svelte recently announced that their web app framework Sapper would not be releases and instead introduced an alternative template within it's place).

As a former Backbone.js SPA developer and currently a vue.js and whatever else developer, the one thing I've always felt all of these frameworks forget about is the data later. Before React we had MV* frameworks, where the Model later, the data, came first and the templating and rendering side would pull from the model. With React, Vue and Angular, the data and the rendering tends to get mixed together in a confusing jumble of code that gets worse, the longer the project lives. Svelte doesn't necessarily solve all the problems that React and Vue have, but at-least it's a fresh start

TLDR; give it two years, then it should be usable in production for a couple of years until the framework inevitably becomes too complicated, convoluted and bloated to be practical in new applications just like it's predecessors.

1

u/sshaw_ Jan 16 '21

How many people using Svelte use CSS in JS?

-2

u/yeahdixon Jan 16 '21 edited Jan 16 '21

No vdom. I actually am a fan of this but they say that performance is lost doing updates to multiple dom elements one at a time rather than a single pass. The other thing is that I thought vdom would theoretically allow for rendering out to different platforms, though that really has not happened yet.

-35

u/[deleted] Jan 15 '21

Loll any random js framework would beat react so don’t think this is an achievement

-14

u/LastOfTheMohawkians Jan 15 '21

Nobody mention angular. 🤔

1

u/ryan_solid Jan 17 '21

To be fair it was the only popular framework other than Svelte to go up in Satisfaction this year.

→ More replies (1)

12

u/[deleted] Jan 15 '21

[removed] — view removed comment

7

u/[deleted] Jan 16 '21 edited Jan 16 '21

React has a lot more overhead than svelte. This is from my limited understanding.

So take that with a grain of salt. But the virtual dom causes overhead. You have to do virtual dom diffing and then also make the changes to the real dom and sometimes one change to a div will require the whole component to rerender. So svelte being a compiler can build very clean code that doesn’t need to use virtual dom.

Here is a good read: https://svelte.dev/blog/virtual-dom-is-pure-overhead

Edit: grammar

7

u/qudat Jan 16 '21

React has rarely been the performance bottleneck on all of my prod apps and when it is there are ways to tune it.

→ More replies (1)

6

u/brainless_badger Jan 16 '21

Overhead of virtual DOM is greatly, and I mean greatly, overstated. Preact is nearly as fast as Svelte, and Inferno is faster - both are vdom libraries.

React's overhead comes from other places, like literally re-implementing event system.

3

u/ryan_solid Jan 16 '21 edited Jan 16 '21

How about an article based on actual measurement: https://medium.com/javascript-in-plain-english/javascript-frameworks-performance-comparison-2020-cd881ac21fce

Svelte is still component/control flow granular so it does do a nice chunk of re-evaluation, but it doesn't need in most cases to traverse down all its children. This makes it much faster than naive VDOM implementations. Precompiling DOM operations without running through what amounts to a giant switch statement for each part of the template also gives some nice gains.

2

u/[deleted] Jan 16 '21

Yeah you can see how fast svelte is but this article doesn’t show react vs able te the actual site has all frameworks. I couldn’t find the actual site but that allows you to pick and choose frameworks for comparison. This article still shows vanilla js vs svelte which is a good comparison.

→ More replies (4)
→ More replies (17)

0

u/[deleted] Jan 16 '21

[deleted]

1

u/[deleted] Jan 16 '21

I don't like Svelte syntax. And I'm afraid to say this because fanboys will start complaining about JSX without realizing JSX is just JavaScript and that is the reason it took off.

3

u/shuckster Jan 17 '21

What do you mean, "JSX is just JavaScript"?