Mar 03, 2026
Recently I found myself using Svelte instead of React and SvelteKit instead of Next.js. Why tho?
Altough SvelteKit is top-notch when it comes to performance, my decision was mostly driven from Next.js perspective meaning I was thinking more about trying out something other than Next.js. Let's break it down.
Next.js as a go to stack
For many years Next.js was a go to framework for me. If I wanted to build something fast,
Next was my choice; if I wanted to build a fully developed dashboard from scratch, Next
was my choice, etc. To be honest, most of the time I enjoyed building apps with it.
Full-Stack apps were never easier for seasoned JavaScript/TypeScript engineers.
A little bit of Prisma here, a bit of Server Actions there, tiny pinch of
Tailwind CSS and you're good to go.
You quickly get used to it. Implement different caching, whether on fetch api dircetly or
by using unstable_cache or some other option that was experimented with along
the way. You're developing your app now - BOOM - there's a new next.js version with unstable stuff now being stable. Naturaly, you upgrade
while developing because is faster and safer then planning an update later and because you want
those stable features.
Once you update, Next.js has shifted it's approach to caching. Now there's a new directive
called use cache;
but, you have to enable it via next.config.js and if you do it also enables different caching behaviour for the whole app, which you now have
to understand.
Turns out it made my development slower for a lot of different reasons. One being that you
now have to add suspense around every little thing in your code, because of faster data
loading and non blocking rendering. Ok. I see the point, but - I have to either add layout
level loading.tsx and move quickly and later refactor everything to proper
suspense usage or I have to suspense everything at once which requires a lot of nested
components and wrappers,
especially if you're like me and you get used to those server calls instead of client ones.
I even found some strange behavior with this new approach and posted a Reddit thread about it.
I know, you can work around this stuff, but the thing is this was just a drop
in ocean of things I can't even remember, but were making a DX worse in the last year or so.
I am not even going to write about how blurry the line between server and client has become, and how React now is pushing small changes to accommodate the next.js way of doing things. Which is fine in some manner, but I don't know... For me the amount of (bad) magic React and Next.js were introducing lately got too much.
Enters SvelteKit
Boy was this refreshing? Signals are part of Svelte, fetching data is opinionated, forms
are easy to work with, routing is an older brother to next.js', the whole framework is
opinionated and I loved it. It was Ruby on Rails or Laravel but for
JavaScript ecosystem, in a good way. It has strictly defined idea and way of doing things which
just felt right and predictive for the most part.
I found that Svelte has it's own passionate community of engineers that really enjoyed making the framework better.
This blog is written in Svelte. I love that SvelteKit is so opinionated, because I enjoy
the structure it brings. It is also very flexible. Some would say it's too much, writing
script tags, etc, but I find logical.
.svelte files are your components and they use script for JS and plain HTML for markup. No,
className or different renamed attributes, you feel closer to native HTML feel as it should
be.
Now with remote functions coming in, mutations and data loading is even easier. locals object for shared server state is also very powerful. Things just work. And for me at least
with much enjoyable DX then I had with Next.js for decent amount of time. For now I am sticking
with SvelteKit for new personal projects at least, until I learn more about it. JS ecosystem
is constantly changing so it would be stupid to lock myself on one thing. But for now - good job SvelteKit!
Should you still learn React?
This doesn't mean and shouldn't discourage you to continue learning React. Especially if
you already started. React is still the most used frontend JS library (officially not a
framework 😅) today. It is still at the top of the latter when it comes to employability,
as number of companies are using it. Developer community is strong and getting stronger
day by day, especially with AI's being trained on large number of React coding practices
and samples. So, if your goal is to find a job in programming or just want something
that's backed up by heavy developer community, React is still a good choice.
This article
is mainly written from the personal DX stance and how it formed my way of thinking recently.
In the ever-changing JS community it is imperative to be profficient in something, but that doesn't mean once you become profficient, that you should stop exploring other stuff or compare it to what you already know. It is an ongoing process of learning that keeps us sharp and competetive. Gives us new perspecitives on how things could work and look like. At the end, that same curiosity and learning process is to "blame" for majority of good things we have and use in today's tech. Essentially, that's something that no AI could ever take away from us, since it is formed and shaped by what we as engineers geek about.