[HN Gopher] Svelte 5 and the Future of Frameworks: A Chat with R...
       ___________________________________________________________________
        
       Svelte 5 and the Future of Frameworks: A Chat with Rich Harris
        
       Author : ulrischa
       Score  : 61 points
       Date   : 2025-01-28 19:53 UTC (3 hours ago)
        
 (HTM) web link (www.smashingmagazine.com)
 (TXT) w3m dump (www.smashingmagazine.com)
        
       | pickle-wizard wrote:
       | I recently started on a frontend project using Svelte, knowing
       | nothing about frontend development. I've found it very easy to
       | use. I had a few failed attempts at this project in the past
       | using React, but I found it quickly overwhelming.
       | 
       | The tutorials on the website are excellent and that was all I
       | needed to get started.
        
       | rykuno wrote:
       | Svelte(kit) renewed my love for web development. It gets out of
       | the way when i want it to, is build on web standards so i'm not
       | stuck on annoying "gotchas", and has all the tools I need to
       | build something without pulling in 20 dependencies just to build
       | a basic app.
       | 
       | After being a skeptic of svelte 5, its fully captured me.
        
       | bunsenhoneydew wrote:
       | A team I work very closely with as an architect has ditched React
       | in favour of Svelte and the team love it. Everyone prefers it to
       | React and finds it easier and more productive to use.
        
       | infecto wrote:
       | I love love love Svelte/Sveltekit. I am an experienced backend
       | engineer and this is the first time I have worked in a FE
       | framework that just clicked.
       | 
       | What I like:
       | 
       | - Not a whole lot of magic syntax.
       | 
       | - The structure of files feels like I am building a backend app,
       | its quite logical and easy to parse through.
       | 
       | - Easy to get up and running, I am sure the decisions exist but I
       | struggle historically with all the sidecar products that can be
       | added into the frontend framework.
       | 
       | - It combines the beauty of native JS/TS with svelte. I can
       | hydrate a store with my own hand rolled api calls.
       | 
       | - There is not a whole lot going on from a API/user perspective.
       | I have stores and routes which are built into the folder
       | structure. I am sure there is more but that gets me to a useful
       | MVP.
        
       | ptsd_dalmatian wrote:
       | After years of react, svelte is such a relief. It's such a joy to
       | do webdev again. Claude's auto completions in Cursor are often
       | not great though.
        
       | ggregoire wrote:
       | I've yet to find a problem with React that would justify learning
       | one of those new frameworks. I know it's popular to say React is
       | bad on the internet, but have been using it for 10 years now and
       | it's still going strong in my opinion.
        
         | rk06 wrote:
         | UseEffect(), dependency tracking, too much re-renders??
         | 
         | Problems galore in react, you should try out new js frameworks.
         | Atleast vue and solid, to see what else is on the table
        
           | codinhood wrote:
           | There are definitely problems with react, but I think his
           | point was that they're not big enough to justify a change.
           | 
           | Though I agree trying other frameworks is a good practice.
           | See what you're missing, or understand your preferred
           | framework better.
        
         | mcv wrote:
         | Every framework has its shortcomings, and React just as much so
         | as any other. Learning other frameworks is always worthwhile.
         | I've done Angular, Vue, React, and am currently looking into
         | Svelte.
        
         | xrd wrote:
         | The problems aren't with React itself. The problems are
         | external to React. But, that's a huge problem.
         | 
         | You need to use a separate library for CSS with React. Svelte
         | has the best way to deal with CSS built in. Which CSS library
         | do you choose for your React project? There are so many
         | libraries to consider, and so many bugs in each of those
         | libraries.
         | 
         | You need to use a separate state management library with React.
         | Svelte has state management built in. Which state management
         | library do you choose for your React project? There are so many
         | to consider, and so many bugs.
         | 
         | People think they want to use React because of the "ecosystem."
         | But, they don't realize that React coerces you to use an
         | ecosystem, an ecosystem that is full of buggy software and
         | those bugs create impossible permutations of configuration
         | issues and bugs (see Create React App). Bugs are not specific
         | to React at all, all software has bugs. But, React forces you
         | to use an ecosystem, and that's a bad thing. I write a lot of
         | Svelte code with very few external libraries.
         | 
         | React does give you job security fixing all those bugs. I'll
         | give you that. It is a wise career choice.
         | 
         | Svelte 5 is a big change. But, today, I refactored a bit of
         | reactive code (which talks to a server and uses async code)
         | inside a single template into an external shared component.
         | That component has reactive code that can be shared across
         | Svelte UI components. I could do that before with stores, but I
         | had to be careful about how to use the reactivity. This new
         | component isolates the reactivity in the right way and shares
         | it in the right way. And, that share component is testable. It
         | is an incredible experience when you get it.
        
       | tobr wrote:
       | I've been using Svelte for several years, but haven't had much
       | time to dive into the many changes in 5.
       | 
       | Maybe someone here can shed light on something about runes that
       | feels very off to me. The rune is on the wrong side of the equal
       | sign? Like:                 let counter = $state(0);
       | 
       | Looks like a reactive value assigned to a variable, but that's
       | not at all what's going on. It's actually a reactive variable
       | initialized to 0. So, for example, despite what you'd expect you
       | can't even move the $state call into a utility function if you'd
       | have some reason to. Very counterintuitive to me, and not really
       | touched upon in the docs as far as I've seen, but I have to
       | assume there's some practical reason why they did it this way.
       | 
       | I remember Svelte 2 (or 1? Can't remember) had some weird things
       | like this as well, where you'd think you could do something based
       | on your experience from JavaScript but I just wasn't supported.
       | The label syntax in Svelte 3 was pretty brilliant because it was
       | a clear indication that you shouldn't expect normal JS rules to
       | apply. It did have other problems that they appear to have fixed
       | though.
        
       | nhumrich wrote:
       | I loved svelte. But svelte5 seems to be a bit of turn off. It's
       | not even the runes. Slots was hands down the best feature of
       | svelte. And they deprecated it I still can't for the life of me
       | figure out how the new way is supposed to work. The migration
       | docs are very limited. And it's super weird that the parent has
       | to intentionally render children instead of a slots? Also, why
       | deprecate the on:event syntax?
        
       | msie wrote:
       | All these frameworks just tell me there is a big problem with the
       | way browsers deliver web apps.
        
         | greenchair wrote:
         | Plus they continue reinventing themselves because that initial
         | design just wasn't good enough.
        
       ___________________________________________________________________
       (page generated 2025-01-28 23:01 UTC)