In the web development world, sometimes it can feel like a new frontend framework comes out every day! Most come and go, but one thing is for sure:...
For further actions, you may consider blocking this person and/or reporting abuse
Don't learn one framework, instead learn the concepts and patterns behind all of them – and the differences that can help you choose the right tool for the job.
No framework or library is a silver bullet. But the right choice can save you a lot of hassle.
By the way, svelte is great for smaller apps, but inexplicably doesn't scale too well. Try Solid.js.
I think 1. Learn JavaScript fundamentals really well and then 2. Learn framework fundamentals (any framework)
That will make it easy to switch to whichever one is needed.
Not the first time seeing such an answer, but it is kind of overwhelming without the right knowledge. Would be grateful if you could specify some of the core concepts and patterns that you're talking about
You are right; I reached the same conclusion last Thursday and I'm already on it. The article is actually almost ready, but I want to proof-read it a few times after getting it out of my head, so I'll publish it next week. In it, I elaborate on state, effects, memoization, reactivity and templating.
Awesome! Eagerly await for the article 🔥
And here it is: dev.to/lexlohr/concepts-behind-mod...
Finally someone giving the right answer to beginners.
what do you mean by " svelte is great for smaller apps, but inexplicably doesn't scale too well. Try Solid.js." why does svelte fail for larger apps? what does solid have that svelte doesnt and more importantly what is your affiliation with solidJS?
Have a look at this: dev.to/this-is-learning/javascript...
I'm not sure why this is the case - I would submit a PR to Svelte if I knew how to fix this.
Svelte outsourcers a lot of complexity into its wonderful transpiler. Solid only uses its transpilation for efficient templating and re-uses its reactive system for everything else.
And why is it important that I am part of the Solid.js community? I have merely stated an observed fact. You can test it for yourself.
I learned Svelte before React, and now React feels unnecessarily complex every time I use it 🙈
I sort of disagree with the "React has more libraries" part by the way. You can use any JS library with Svelte.
So phrased differently, you could say "React requires libraries to be wrapped before usage"
Yeah it's always tough for me to go back to a React project after working in Svelte!
The trade-off is now you need to maintain a custom svelte-react wrapper.
imo, generally, more code, more problems.
Guess what now you need documentation, tests and more!
Great article, well-written ... of course a simple code example like this does not prove that Svelte has all of the imaginable bases (use cases) covered like React has, but I'll just assume it has.
So we can conclude that Svelte has only pros, no cons, compared to React (except that React dominates "the market", but that's not really a characteristic of React itself but more a meta-characteristic).
The only "downside" of Svelte might be - that SolidJS might be even better? :)
Haha, I need to try SolidJS, been hearing great things.
Yeah, the real competition should be between Svelte and Solid, not between Svelte and React - but we're all "forced" to use React, even though it's inferior in almost all respects, because, well, it's the proverbial 900 pound gorilla in "the market" ... kind of saddens me, but oh well.
SolidJS and/or Marko for 2023. Check out Ryan Carniato on YouTube to find out why.
Interesting I'll for sure check it out!
I should probably also mention that Ryan is active on dev.to
dev.to/ryansolid
An effective way to learn something is to compare it to what you already know. Great comparison with React, it gave me a the gist of what Svelte is.
In all my time looking for jobs though, I have not seen a single job that had Svelte written anywhere (Canada). Interesting to see adoption by those big websites though. Excellent article!
It's slowly becoming more propular and easier to adopt. SvelteKit (next.js equivilant) has just been fully released out of beta (v1.0.0) so that should help with adoption.
Svelte definitely looks cleaner and the idea of smaller bundles is appealing!
Great post, @mikhailkaran!
Appreciate all the help from you and team on the post!
Pleasure, simplicity and beauty are very important.
"Pleasure" is non-technical term, not easy to measure but very important.
Almost 10 years ago I had dilemma, what next modern language to learn: Python vs Ruby.
Then I examined list of popular ruby projects and list of popular python projects. And what I've found:
So, I decided Python is more fun to use. And yes, after many years with Python I still think I did right choice. It's pleasure to use Python both for work and for fun. And I work more efficiently when it's pleasure to work.
Also I think Python won this race and now much more popular. Because of "pleasure".
Now, I have little more then "hello world" experience with most popular frameworks and I'm impressed with Svelte and working with it. Clean, simple, easy. This is very important. And I think these defines future.
This is actually a really nice comparison.
Good to see that React gets more and more competitors which begin to reach the right level of stability and reliability to be a real competition.
This will lead to massive improvements in the React.js project, too, I can imagine.
I don't think Facebook wants React to be beaten by the new kids on the block and that they will rather choose to improve React to be much better in performance.
Also I wonder what else you could use at the moment as an alternative to React and in which cases?
What's currently good for creating different sized projects?
Small ones -> Svelte, ...?
Mid sized ones?
Enterprise level big ones?
Vue.js is a great alternative that has more and more usage in the real world.
The smaller ones like Solid and Astro are also creeping up.
Svelte is way better than react, has less boilerplate, easier to maintain and easier to learn. If I am to build my personal project, Svelte is the way to go for me.
Same.
There is a mistake in the article.
When comparing Svelte vs React I mentioned Svelte has a built in router and that is not true.
Will be doing a minor rewrite of that section shortly.
Sorry everyone!
Your Svelte code breakdown section shows react snippet. Can you fix it?
Great catch, sorry about that.
Just edited it with the right sandbox.
Thanks for this detailed comparison 🙏
No problem!
Hey, i'm going to take a look at svelte for my project.
What do you'll recommend for create a school website from react and svelte
The svelte documentation has a great tutorial built in it! svelte.dev/tutorial/basics
If you need something a bit more guided I've created a Svelte for Beginners course on Udemy: udemy.com/course/svelte-for-beginn...
That's a great article & now that I've learned quite a bit about React I'm going to take a look at Svelte. Thanks for sharing.
Keep writing 🥳
Will do! 🫡
Great Article brother.
Appreciate it Sohrab!
Solid.js for me.
But why not Angular? Although its high learning curve, Angular is a real framework and offers all you could need in native way (expecially state management and HTTP methods). IMHO Angular is the only choose in medium/big projects.
I think you're comparing react and svelte kit. Because svelte doesn't have routing baked in by default and svelte on it's own will render on client side, etc. Svelte kit is what adds most of the bells and whistles you were taking about in favor of svelte, just like NextJs for react.
React in the end also uses basic DOM manipulation (if you dive into the framework code). I haven't used Svelte yet, although its something I'm tracking... I'm really not a fan of this weird looking template style comments inside your HTML code... It's seems to me like a step back to the days of ugly PHP template engines. However I'm just one person and unfortunately it seems I'm incapable of convincing people that this is a bad idea :(
haha, as I remember, before PHP template engine as Smarty, I had to mix HTML and CSS within PHP script files, exactly as same as what React devs have to do today: write HTML and CSS with JS script 😅
Uhm, and with svelte you're not? The difference is, in React you're only writing JavaScript (and jsx) it all follows JavaScript rules, you dont have to learn any weird syntax logic, like with smarty or svelte.
and with React, to handle state you need the weird hooks which comes with weird rules AND to use them properly without re-rendering mayhem you need to memorize
There are a lot of different state management solutions for React. If you dont like what is currently offered, you can easily write your own, its all standard JavaScript. Yes there are some hooks you should probably learn about when you want to properly use React but there's no weird syntax, its all basic JavaScript and JSX.
Great article! Svelte was the one that got me into web development, and I was able to slowly get comfortable with learning anything web dev-related because of it.
Correct me if I'm wrong, but I believe Svelte has no built-in routing functionality. Thank you for this article.
Svelte. There is no other answer. Svelte returns us to plain JS where we can use any library we want and we are not locked in to whatever is available for a framework. React has to go! It's anti patterns are a cancer on web development.
Neither. SolidJS is the way.
The statment "React requirers third-party libraries and tools like Redux" - is wrong. React has built-in rich state managment - useState, useRedux. react-router and react-dom - are not exactly third-party libs.
In my opinion, Svetle is promising framework, I'd like to try it, but now I'm keen more about Flutter.
Nice article, thanks. Now I definitely want to try Svelte, sounds very promising :)
Thank God, Zuckerbucks has a competitor in the rear view mirror. Not to mention Wasm. React just like the others is opinionated. Ridiculous in this day and age.
Does Svelte have Module Federation & Library functionalities? For example, you can create functions and import them in any part of your app. Also, your app can be split in Modules that work together.
These are what may attract me to Svelte. I presently enjoy them in React.Js, although with extra customization.
We're developing an app in Sveltekit with great success and by combining with capacitorjs.com/ we have both Android and IOS apps using the same source code (including native features access from Javascript). Very happy so far.
Svelte looks so similar to
Vue.js
. Just useVue.js
It has some significant benefits over Vue. I love Vue though and still use it on some projects but I pick Svelte more often now because of it's simplicity and speed.
I have always wondered why React insists on using the virtual DOM. Is it really that much faster than good old direct DOM manipulation?
To specifically comment on the title of this article, if you intend to get a job / better job then React will provide a lot more opportunities than Svelte.
This is true. At this point it is way more in demand in the job market.
Svelte. Just drop React, it's a mess! End of discussion
Vue.js
Svelte itself doesn't come with a build-in router, but you're propably talking here about SvelteKit.
Correct me if I'm wrong.
Great article! 😀
I'll be honest...I screwed up there and confused it with Vue which has a 1st party router (not built-in) that is developed by the creators 😅
Going to post a edit to the article shortly with that.