3 ms·
While yes, Svelte is faster out of the box than React, that's not its main draw in my opinion. When you learn React, you learn React's idioms, its methodology,
by ttfkam 3y ago
While yes, Svelte is faster out of the box than React, that's not its main draw in my opinion. When you learn React, you learn React's idioms, its methodology, the common component libraries, etc. You learn its API and patterns.
Svelte follows the patterns established by HTML and CSS, and builds upon them. If you know how to write static HTML, you will already be familiar with the structure of a Svelte component. If you know CSS, the <style> tag in Svelte is natural to you (except that CSS styles are scoped to component by default, so it's actually easier than plain CSS).
For the JS, you don't have to research to find out what the hot client state management tool of the week for React is. You don't have to worry about useState vs useEffect vs useMemo. You don't have to worry about how to integrate with a reactive library like rxjs. You just write what looks like plain JS + things like "$:" and "$store", and you're done.
Developer performance is what matters most here. React has an advantage for now due to a decade of inertia, but folks coming up who don't already know React or folks who are feeling burned out by React due to huge transitions like classes-to-functions? They're the target audience who's gonna try Svelte and realize they've been living with Stockholm Syndrome for a while now.
Things like useMemo(…) are abstraction leaks. They are mental overhead and boilerplate over and above the actual problems people are trying to solve.
Gimme someone with HTML/CSS knowledge and basic JavaScript skills, and I'll deliver a viable Svelte developer in a day or two. That's something React cannot match and will never match.
Will React disappear? Of course not. Even COBOL is still in use. No one's dumping React and a large codebase on a whim. But when more folks realize they can use GridJS and ChartJS and other vanilla JS libraries out of the box with Svelte without an elaborate stack of bespoke wrappers to make them work, React's ecosystem will not seem quite so rich in comparison.
Folks writing for greenfield are gonna think twice about React.