Hacker News new | ask | show | jobs
by kayson 1099 days ago
I'm curious what peoples' experiences have been using modern react vs svelte vs whatever else is popular these days. I used react a while back for a dashboard mockup and was pretty happy with it.

Something about svelte being a superset of standard html/js/css that gets compiled bothers me. I realize that the same can be said about typescript/tsx but I feel like in can trust it more... Maybe it's a maturity thing? Or that it's just one language getting compiled to its subset (with syntactic sugar for dom elements)

8 comments

I hadn't built a proper web app in nearly 10 years until recently. I did do some experiments with React/Redux a while back, and some Angular. While both made logical sense, I found RR quite confusing and Angular very heavyweight.

I tried SvelteKit 2 weeks ago after working through learn.svelte.dev and it immediately appealed to me.

Starting with one file in a route that holds JS, HTML and CSS was great. Breaking it up into components as I went along was natural. I think TailwindCSS helped here too, because I barely had to do any CSS work and could focus on JS and HTML.

It took me a while to understand the value of stores and where to use them, but then I hit upon a use case (big complicated multiple nested tree of mutable data).

After a few refactorings I had a very nice compact and easy to understand solution - nothing like what I experienced with RR and Angular.

I had the same experience. While I understood React principles, I never quite got how to built large things with it.

Svelte clicked after like 3 hours.

Also it's more "fun" than React ever was.

to be fair redux is a huge pain in the ass especially for medium to large teams where you have colleagues who misuse it.

there are better libraries out there like zustand or react-query which helps on most of these stuff.

I'm a big fan of svelte vs. other frameworks. The closeness to vanilla js and natural coexistence with html+css makes it so smooth to work with and you feel productive right away. Recently built this with it: https://meoweler.com

At least for small projects like this, it's perfect. For something larger/complex I'd be a bit more weary.

That website is AWESOME. I also found your dribble. Your work is absolutely stunning and inspiring.
Great site. Some feedback:

* Main search (bottom center, not top right) taking over the screen when you click on desktop is terrible ux

* Should support some fuzzy search or misspelling tolerance, e.g. Cuzco for Cusco

* Valencia, Spain gives a 500 error

* No keyboard bindings when searching to navigate up/down between the matching results (e.g. type in 'Valencia' and I expect I can use the down key to choose which of the three results)

I feel like React is more complicated these days for little gain. I've worked in Knockout.js, Aurelia, Svelte, Vue 2, Vue 3, and now React.js. To me, React.js was more complicated to learn than almost all of them (Knockout.js is older so that felt more complicated to me). My favorite was either Vue 2 or Svelte - they're just simple to learn.

In my opinion I feel like React.js was ahead of its time, but now we're seeing some competitors achieve the same (or better results in terms of benchmarks) with simpler approaches.

Keep in mind these are just opinions, and I'm only about a month into React in a massive web application. That said, it took me like a literal day to learn Vue 2 because it was mostly just like native web development anyways.

I really do like TSX (react + typescript) for the exact things: Functional Components & Hooks - which are basically functional (albeit impure) building blocks for UI things and interactions. Sure, there goes on a lot behind the scenes and so on, but these two things is for me like "perfect" for composing UIs out of reusable building blocks.

But I really hate how react does not have a "blessed"/"official" router or state management, and a lot of "innovation" in this space simply looks like fashion waves nowadays, often reinventing the wheel, and are getting unpopular again over time.

I personally do use Meteor again these days to have real fullstack stuff easily, which has built-in state management (client-only collections work extremely well for state) when things become more complex than a few useState things. Also SSR "just works" with this, since a useTracker (from meteor) is executed during SSR cycle (as opposed to useEffect API calls), including rehydration with a fast-render package.

This absolutely is crucial for my projects, or else stuff like proper SEO is simply a pain in the ass. I would even pay money for react to have kind of renderToString on the server that simply BLOCKS (or awaits) during SSR so that the initial HTML contains fetched data. The discussion about react server components at this point is just comically absurd for me, as if they really want to make the simple SSR requirement as complex as possible for no reason, other than maybe force users into Nextjs so they can make more business from magically working hosting.

> But I really hate how react does not have a "blessed"/"official" router or state management, and a lot of "innovation" in this space simply looks like fashion waves nowadays, often reinventing the wheel, and are getting unpopular again over time.

From an ecosystem view point I think that's really cool! It means that they're not tied to anything and you can pick what works for you. The community, of course, has found its go-to solution anyway, fittingly named "React Router".

The state management situation is more complicated and I think that's even more beautiful, because someone liking Redux can just use it for themselves instead of it being forced on everyone.

Svelte is a better experience IMO. Faster and doesn't require manual hacks to gain a 0.005% speed improvement.
The biggest pro to choosing the likes of Svelte (or Vue, htmx, long list of newer frameworks that have learned from React/Angular's shortcomings) is how few footguns there are.

That's really the big thing. I know everyone loves to believe they're masterclass programmers and falling for such traps is beneath them, but after seeing some of these masterclass programmer's react repos... it's very clear why the react docs is filled with many disclaimers and notes (which kudos to the react team for phenomenal docs).

If it's only a 0.005% speed improvement the manual hacks probably aren't required :P
you can download a html page from some website, rename it to `.svelte` and it will mostly work just fine with some minor modifications like remove the html wrapper tag and rename `<head>` to `<svelte:head>`.

I don't think the same thing apply for any other popular frontend frameworks.

I love Svelte because prototyping a new feature in it is really really trivial, even with keyboard interactions and animation effects.

I haven't used it as much as I used react based frameworks, or angular, but the little I've used it I really like the development experience. Plus the payload sent to the end user are much smaller.

Svelte isn't a subset of js/html/css, it just uses them. Svelte does support typescript as well.

Not sure about it being a superset, my understanding is that react is a renderer, whereas svelte is a compiler, basically removing unused code from its std lib, and even converting some code to native JS code. It tries to work with the DOM not around it.

SolidJS is the one I am really excited about moreso though, since it uses JSX and works even moreso with the DOM.