Svelte 5 Is A Triumph

Sdílet
Vložit
  • čas přidán 29. 05. 2024
  • This video is a comparison of the changes between Svelte 4 and Svelte 5.
    🔴 Patreon: / joyofcode
    𝕏 Twitter: / joyofcodedev
    💬 Discord: / discord
    🔥 Uses: www.joyofcode.xyz/uses
    🔗 Examples: component-party.dev/?f=svelte...
    🔗 Svelte 5 Docs: svelte-5-preview.vercel.app/d...
    🔗 Is Svelte 5 Ready Yet?: svelte-5-preview.vercel.app/s...
    🔗 Svelte Summit: www.sveltesummit.com/2024/spring
    🔖 Timestamps
    0:00 Intro
    0:22 Reactivity
    2:26 Computed State
    3:22 Effects
    4:18 Abstracting Logic
    8:46 Templating
    9:01 Events
    9:53 Referencing The DOM
    10:44 Conditionals
    11:14 Lifecycle
    12:14 Props
    13:02 Sending Events
    14:04 Slots
    15:13 Context
    17:06 Binding Form Input Values
    17:52 Initializing Svelte
    18:34 Fetching Data
    21:03 SvelteKit
    21:17 When Is Svelte 5 Going To Be Released?
    21:53 Outro
    #joyofcode #sveltekit #svelte

Komentáře • 403

  • @mnmr
    @mnmr Před 3 měsíci +9

    Svelte 5 is basically an admission that S4 was never really a compiler that understood your code but just a regex parser or some similarly stupid processing logic. S5 is one step forward in flexibility and three steps back in usability.

  • @pm1234
    @pm1234 Před 3 měsíci +33

    Thank you for the breakdown! It confirms that I don't like Svelte 5, haha. Svelte was SIMPLE, with an understandable syntax, now it becomes obscure.

    • @aexelm
      @aexelm Před měsícem +6

      Exactly!! I left away ReactJS so long time ago because Svelte... Now, I'm thinking to get back again! What a sadnesss thing!

  • @stuvius
    @stuvius Před 3 měsíci +56

    I just don't understand. I have a massive project where I have literally zero issues with the current Svelte, so I'm not sure what problems are being solved by doing a complete pivot with the design like this. I hope I'm wrong about this because I switched from React to Svelte to get away from this paradigm.

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +12

      Try it and if you hate it I'm going to eat my shoe.

    • @daleryanaldover6545
      @daleryanaldover6545 Před 3 měsíci

      ​@@JoyofCodeDevbonkers I'm going bald over this 😂

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci +9

      They literally fixed Svelte with this update you should look more into reactivity.

    • @thetooth
      @thetooth Před 3 měsíci +21

      Yeah I don't get it either, I dropped vue for svelte for no other reason then to get away from the endless $ref statements, now it seems as to have gone full circle back to what all the other frameworks use.

    • @XRENDERMAN
      @XRENDERMAN Před 3 měsíci

      @@JoyofCodeDev that's the thing. On a big project, making a switch is prohibitively expensive. There are a lot of braking changes and as far as I understand you either use runes or new syntax but not both in the same project. I wouldn't update to V5 and would just stick with V4 if that's the case.

  • @jrgensneisen6021
    @jrgensneisen6021 Před 3 měsíci +19

    Im sorry i dont really see it yet. There were never any problems with onMount and onDestory, they were well named and really intuitive, the $effect is not for me. The context example is really not much different, the only difference is really writable vs $state, and then mixed in some getters and setters....

    • @jeffreysmith9837
      @jeffreysmith9837 Před 3 měsíci

      main thing is performance

    • @afaha2214
      @afaha2214 Před 23 dny

      I just started learning Svelte and looks like 5 is what makes me sold. already i can tell you it improves my experience. just wish it would be released soon so we can ship production

  • @adhec
    @adhec Před 3 měsíci +17

    This is what I expect when Runes is release, the comparison between the old version. Thank you for making it crystal clear!

  • @rumble1925
    @rumble1925 Před 3 měsíci +31

    I'm so tired of the JS ecosystem. 10 years doing this, I haven't used the same techniques and tools on any project. I really thought Svelte was breaking the cycle.

    • @ionutale1950
      @ionutale1950 Před 3 měsíci

      Is not the change that bothers me, but idiotic change.
      Signals were invented invested in 2010 by Knockout.js team
      React tryied everything else.
      Angular went with rxjs.
      Now both are moving into signals.
      Signals are great.
      But the new syntax in svelte is just bad.
      It will lead into verbose, matrioska code
      Take {@render children()} for example. Now children expect some props…
      With this syntax, people will be encouraged to write matrioska code.
      was like: “ok, I need to stop adding code here and create a new file”.
      Good and bad decisions are based on previous ones.
      Good decisions, attracts good decisions.
      Bad decisions, attracts bad decisions.

  • @noeljose
    @noeljose Před 3 měsíci +31

    look how they massacred my boy

  • @deado7282
    @deado7282 Před 3 měsíci +24

    Hate it. I was fine with the old syntax, it was way more concise.
    Now its going to be depricated. I'll delay switching as long as possible.
    Why do js frameworks have to reinvent themselves every few years? Why fix svelte, it wasn't broken.

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +1

      You would be surprised if you tried it.

    • @justin8mux
      @justin8mux Před 3 měsíci +2

      Agree. Hope we avoid "the python way" with v2.7 / v3.x

    • @lucasjames8281
      @lucasjames8281 Před 3 měsíci +8

      @@JoyofCodeDevdude anyone can get used to anything, this is objectively more verbose, for little benefit

    • @LinhLinhBD
      @LinhLinhBD Před 3 měsíci +5

      @@JoyofCodeDev people say that when react comes out after angular. Now everybody hates react. people who think the latest way is the right way and the best way to do thing only find themself an idiot after sometime.

    • @Mr.BinarySniper
      @Mr.BinarySniper Před 2 měsíci +1

      @@JoyofCodeDev Nobody is going to be surpised.. because before I saw and we surprised. but now if we saw, we hate it.

  • @laztheripper
    @laztheripper Před 3 měsíci +22

    What's the point of this? You could have used writable() and derived() in components before, and they do the same as $state() without muddying the waters with implicit getters and setters.
    Getters and setters are a trap, they fool us into thinking we're simply accessing memory, but instead they're running a new function adding more overhead.
    Creating a new object for every piece of state to avoid defining getters/setters is also not a good solution when GC is already a problem in JS, not to mention deep reactivity implies these objects will have to be iterated for changes, instead of a single primitive.

    • @mbokil
      @mbokil Před 2 měsíci +1

      You won't need to use spread and cloning to get your data to update. Just modify a property of an object and Bam! the UI updates with Runes. Much nicer and more clear about what is reactive too.

    • @SteinCodes
      @SteinCodes Před měsícem

      The thing is functions can be inlined by the JIT, implementing similar things in the svelte compiler is not feasible.

  • @stuvius
    @stuvius Před 3 měsíci +116

    onMount and onDestroy literally express what they do, and now instead there is a cryptic "effect".

    • @ionutale1950
      @ionutale1950 Před 3 měsíci

      react had the same life cycle methods, and went to useEffect.
      Same happening to svelte 😅

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci +11

      It’s not “cryptic”, Learn To Code

    • @funnynews341
      @funnynews341 Před 3 měsíci +20

      i have the same thinking like you. onMount and onDestroy easy understanding than effect return. Maybe svelte not for beginer like me anymore

    • @figloalds
      @figloalds Před 3 měsíci +46

      @@ivan.jeremic it is cryptic, it doesn't convey when it happens, an effect can happen at any time, or not at all, or anytime there's any changes, or keep happening on intervals, it's not semantically clear

    • @minnow1337
      @minnow1337 Před 3 měsíci +1

      effect has been a react staple term since day 1

  • @alejkun4923
    @alejkun4923 Před 3 měsíci +28

    Hey, How's and why is render() better than slots? No reason was given, if anything it looks worse since it involves more code.

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +6

      I hoped there would be a snippets example so I forgot about it: svelte-5-preview.vercel.app/docs/snippets.

    • @enesbala5195
      @enesbala5195 Před 3 měsíci

      Killer feature - I believe this probably needs a seperate video. Great job on this one though❤@@JoyofCodeDev

    • @sunstryder
      @sunstryder Před 3 měsíci

      It's more explicit that children elements are a prop, and lets you check their existence children and conditionally render, like in the example. I believe before using you couldn't say {#if } etc.

    • @iamnoone3588
      @iamnoone3588 Před 3 měsíci +2

      @@sunstryderyou can have slot fallbacks tho

    • @RodrigoDAgostino
      @RodrigoDAgostino Před 3 měsíci

      @yder it is actually possible with slots, you only need to do something like the following:
      {#if $$slots.default}
      My element
      {/if}
      I hope I’m missing something here, because to me this doesn’t look like an improvement. It’s much more verbose and... what’s the trade-off?

  • @aexelm
    @aexelm Před měsícem +3

    I step beside React because I found simplicity on Svelte. But now, I am not sure if now Svelte are complicating the things like others JS libraries. I loved svelte because its naturallity with JS, HTML, and CSS..... Now, I am not sure at all!... I feel that I need to break a paradigm.... AGAIN!!!!!!

  • @1DJRikkiBee
    @1DJRikkiBee Před 3 měsíci +24

    It seems that Svelte is becoming a lot less...well, svelte.

    • @DEVDerr
      @DEVDerr Před 29 dny +1

      At the first glance - maybe. But it still has a lot of compiled syntax which we all love in Svelte + new syntax is definitely more robust and allows for big performance and DX improvements

  • @TimurMishagin
    @TimurMishagin Před 3 měsíci +8

    As a Lead Angular developer who've been using Svelte for creating a landing to our main app I can say that I will miss the old syntax. This is the one thing which is very simple and it was one of the reasons why we chose Svelte for this task. Now I find Angular's approach to deal with signals more convenient than the Svelte's one. It feels more comprehensive as for me.
    P.S. And yes, all of this refactoring in near future... Gorgeous.

  • @mikhalpalych
    @mikhalpalych Před 3 měsíci

    (7:03) I've been messing with making classes reactive in vue 3 and i've actually made it, but the thing is, if we are going to make watch-effects on an instance of a class that accepts reactive dependencies, there will be an infinite call.
    Is there some specific handling in svelte to this or is example presented just to show possibilities?
    (i don't know svelte at all, just peering and familiarizing myself with it)

  • @Gambit13091
    @Gambit13091 Před 3 měsíci +22

    This seems like more work for the same results imo. Writables are just too easy to work with instead of having to write your own getters and setters. Please correct me if i'm wrong

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +5

      I think you skipped the part where I show that you don't.

    • @laztheripper
      @laztheripper Před 3 měsíci +2

      You don't, you just have to create a new object for every piece of state, right? As if GC in JS isn't already a huge problem for performance at scale.@@JoyofCodeDev

    • @daleryanaldover6545
      @daleryanaldover6545 Před 3 měsíci +1

      ​@@laztheripperand developers still overusing spread syntax with const, these are the problems of GC in javascript and not the framework.

    • @ionutale1950
      @ionutale1950 Před 3 měsíci

      @@daleryanaldover6545 svelte use to mean DX. A good framework can encourage developers to write better code, and svelte use to do this.
      Svelte stayed for: html is already doing stuff, no need to reinvent the wheel in JS.
      Encourage plain css, vanilla html, browser api …
      Now we are slowly drifting towards react syntax, but no virtual dom.
      Before they will figure this was a mistake, is going to take at least a year, this translates into more hard to maintain react projects …

    • @laztheripper
      @laztheripper Před 3 měsíci

      I'm sorry, but I barely use spread syntax, unless I actually need to make a copy of an object/array. You can .push() and then var = var; and it does the exact same without the overhead. And yes, it is in large part the fault of frameworks that encourage creating so many objects that later need to be GC'd. Same goes with array method abuse, which is a lot harder to avoid in react for example.@@daleryanaldover6545

  • @damnnn.
    @damnnn. Před 3 měsíci +8

    what was wrong with on:click that they deleted the two dots and made it onclick? a very unnecessary move.

    • @aliengreed
      @aliengreed Před měsícem +1

      I was thinking the same, you could already pass call back functions as props, now we lose the pipe operator and the clarity that it's a native event attribute 🙄

  • @diegoulloao
    @diegoulloao Před 3 měsíci +38

    Children is now unique? What about named slots? Before it was much simpler.

    • @specialdoom9116
      @specialdoom9116 Před 3 měsíci

      you still have them; they are called snippets

    • @jamesmoynihan948
      @jamesmoynihan948 Před 3 měsíci +2

      I just started converting my old components over. I actually found it easy easier with snippets. You can set fallbacks, named "slots" with snippets, but you also get a nice TS experience with them.

    • @Mr.BinarySniper
      @Mr.BinarySniper Před 3 měsíci

      @@specialdoom9116 understand diffrence between these two first.

    • @mikeonthebox
      @mikeonthebox Před 2 měsíci +5

      Yes I don't understand why he says it's so much better, then it's nothing but more verbose.

  • @DeviantFox
    @DeviantFox Před 3 měsíci +5

    I hope when svelte 5 releases you'll go over a few more of these examples in depth like some of your other videos for those of us who aren't JS pros and more hobbyists... that's always my biggest concern when these packages get major changes

  • @KDX34
    @KDX34 Před 3 měsíci +2

    Hi Joy, sorry if this comment is a bit out of context, but I had a project in mind but I'm having particular problems, just to make you understand, I would love to replicate your website, not all of it obviously, but the "style", I'd like to make a sort of documentation for the italian community, since I'm Italian, hence the bad english, but the point is that I followed your markdown + sveltekit tutorial but it's not turning out like I envisioned, so I was wondering if you could make a video explaining how you've built your website,specifically the blogs section, that's all, thank you for all your videos, they're really helping me a lot 😊

  • @bn5055
    @bn5055 Před 3 měsíci +5

    I'd like to see a practical example of runes in action. Say, a shopping cart or something, rather than just a counter.

  • @nomadshiba
    @nomadshiba Před 3 měsíci +3

    9:40 it think this also makes the client side code and compiler code simpler, i believe, before we had to have a code that handles "on:" directive, but its just the field name on the element now.
    so putting a signal of a function there will just keep updating the element's onclick field when signal changes, so now you can have signal of a function as listener. and also removed the code for "on:" directive from everywhere.

  • @tungly1558
    @tungly1558 Před 3 měsíci +15

    onMount and onDestroy much clearer in meaning and use. Why make them both became $effect?

    • @jub0bs
      @jub0bs Před 3 měsíci +1

      $effect is strictly more powerful. It subsumes onMount and onDestroy, and if the callback passed to $effect references state and/or reactive variables, it will fire when the latter change.

    • @tungly1558
      @tungly1558 Před 3 měsíci +9

      @@jub0bs that's my point. When look in the $effect you have to reason it but with onMount and onDestroy you have since it only have one purepose. I think simple is better powerfull in this case

    • @jub0bs
      @jub0bs Před 3 měsíci

      @@tungly1558 Readability is a legitimate concern, but nothing prevents you from declaring functions with clarifying names:
      function onMount() {
      console.log("onMount");
      return onDestroy;
      }
      function onDestroy() {
      console.log("onDestroy");
      }
      $effect(onMount);

  • @chanandlerbong6176
    @chanandlerbong6176 Před 3 měsíci +6

    I don't hate any of the changes they have done. I hate how you hype up every annoying thing as improvement without any explanations

  • @erickmoya1401
    @erickmoya1401 Před 3 měsíci +6

    I noticed derived are exemplified with const instead of let. Any reason for this? Looks "uncomfortable" as we tend to understand const as non-changing variables, I would feel more confident and without questioning myself if a derived is a let, that will be changed by someone else.

  • @fev4
    @fev4 Před 3 měsíci +4

    the event dispatcher example is not equivalent, because the dispatcher allows to define the logic inside the child, that is, you can extend the clickYes and clickNo functions to do other stuff beyond just dispatching (this is what's powerful about this concept), the alternative doesn't allow that

    • @bozidarbralic1937
      @bozidarbralic1937 Před 3 měsíci +1

      THIS, I've been working on a big project in production with micro frontends using Svelte/Kit, did some React in the past and the moronic shoehorning of the Flux pattern down my throat is downright disgusting. It's creating the need for the HoC bullshit all over again, untiil now I could treat components as classes and do mixins at the dispatched event consumer which composed nicely segregating base behaviour with added behaviour as I deemed it, and I could Type my dispatchers nicely.

    • @jeffreysmith9837
      @jeffreysmith9837 Před 3 měsíci +2

      Just wrap the handler prop in another function in the child...
      Call wrapper, which does whatever logic, then calls the passed function

  • @user-ti8cm3mh1w
    @user-ti8cm3mh1w Před 3 měsíci +3

    Wow! Now svelte v5 come closer to react hooks. Congratulations

  • @SRG-Learn-Code
    @SRG-Learn-Code Před 3 měsíci +4

    11:30 I though onMount did more, are runes targeted to execution only in browser? Is onMount going to dissapear or what isgoing to be his purpouse?

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci

      It's replaced by `$effect` but yeah I think runes only work in the browser which eliminates a class of problems with SSR.

  • @fev4
    @fev4 Před 3 měsíci

    can I use runes outside svelte files? for example can I import a function from svelte to be able to define state logic outside svelte files and then import that into a svelte file?

    • @isdeonf
      @isdeonf Před 3 měsíci

      Yes. You just need to name your file ending with .svelte.js or .svelte.ts

    • @tabiasgeehuman
      @tabiasgeehuman Před 3 měsíci +2

      yep! if a file ends with .svelte.js it can declare runes. It's the main reason they switched over to it.

    • @fev4
      @fev4 Před 3 měsíci

      @@tabiasgeehuman ohhhh 🙏

  • @mikeonthebox
    @mikeonthebox Před 2 měsíci +2

    They are taking away the "Magic" and adding the same kind of hooks as other frameworks. Now it turns out "everything" in Svelte 3 and 4 was bad/wrong But they sold it to us like it was wonderful, and now they are moving away.

  • @Eldalion99999
    @Eldalion99999 Před 3 měsíci +7

    hmm so it has evolved into React.......great

  • @Kevin192291
    @Kevin192291 Před 3 měsíci +2

    Thank you so much for your Svelte work, I have learned so much from you!!!

  • @naughtiousmaximus7853
    @naughtiousmaximus7853 Před 3 měsíci +5

    In 2024 Svelte will gain 5 more job openings, lets gooo

  • @ismail-paine-de-circ
    @ismail-paine-de-circ Před 3 měsíci +5

    "how awesome is this guys"

  • @grenadier4702
    @grenadier4702 Před 3 měsíci +11

    I think something alike would be better
    "let state count = 0";
    "const derived double = count * 2";
    How is worse than {@render children()} ?
    And how do you pass named slots with @render then?

    • @SRG-Learn-Code
      @SRG-Learn-Code Před 3 měsíci

      I guess you make diffeerent props and render each one? children is a named slot

    • @grenadier4702
      @grenadier4702 Před 3 měsíci

      @@SRG-Learn-Code How do you pass these props?

    • @ionutale1950
      @ionutale1950 Před 3 měsíci +3

      I don’t reali like it.
      I will give it a try, and if i will not like it, I will just keep V4

    • @ionutale1950
      @ionutale1950 Před 3 měsíci +1

      Yeahh, render thing is react but worse.
      I guess hiring the infernojs guy was a mistake

    • @Trueadm
      @Trueadm Před 3 měsíci +9

      @@ionutale1950 It's all my fault. Sorry.

  • @SRG-Learn-Code
    @SRG-Learn-Code Před 3 měsíci +43

    9:30 I'm going to miss the old syntax, but it seems like it has a ton of advantages!

    • @theblckbird
      @theblckbird Před 3 měsíci +1

      definitly

    • @diegoulloao
      @diegoulloao Před 3 měsíci +2

      Same, I love on:click, is clear because you have the “on” the “click” not just onclick 🤣

    • @daleryanaldover6545
      @daleryanaldover6545 Před 3 měsíci +5

      ​@@diegoulloaobut this is much more leaning towards standard syntax since onclick is pretty much the right property in javascript.

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci +9

      One more year and you all will fall in love with React😂

    • @figloalds
      @figloalds Před 3 měsíci

      @@daleryanaldover6545 this is not "vanilla Javascript land" boy, this is full fledged framework thingimagiggs, we don't have to constrain ourselves to vanilla miseries, this change is a regression

  • @adriansanchezr.8508
    @adriansanchezr.8508 Před 3 měsíci +21

    This verbosity proves why React and Vue do what they do to know which variables are reactive and control the global state across the app.
    I understand that this new syntax simplifies the Svelte compiler and we can expect better performance, but oh, boy, the dev experience just got ruined :(

    • @ionutale1950
      @ionutale1950 Před 3 měsíci +2

      Exactly Adrian.
      This is exactly my thoughts.

    • @figloalds
      @figloalds Před 3 měsíci +1

      Some are way better, but this $props() kinda sucks, hope we can still declare props with the export syntax

    • @ionutale1950
      @ionutale1950 Před 3 měsíci +2

      @@figloalds yes, export is explicit, and I think is better.
      $props() creates ambiguity

    • @szigyartom
      @szigyartom Před 3 měsíci

      @@ionutale1950 and you add typescript and it looks terrible as well

    • @Antonio-fo4fl
      @Antonio-fo4fl Před 3 měsíci +2

      @@ionutale1950 The props rune is significantly better because it allows us to get rid of the complexity surrounding event dispatchers, it also allows wayyyy easier behaviours around rest props especially spreading props on components and elements. This was a pain in the ass before and makes it way more ergonomic especially for library authors.

  • @stephengruzin
    @stephengruzin Před 2 měsíci +5

    Since so many people are complaining about the new syntax, cant the svelte team hide this new syntax under the hood? let name = "John" can use signals, but under the hood.

    • @Mr.BinarySniper
      @Mr.BinarySniper Před 2 měsíci

      yeah.. its my actual question.. even their new syntax hide the signal. then why older syntax can't hide.

  • @Mixesha001
    @Mixesha001 Před 3 měsíci +5

    Cool it’s like Vue now.

  • @XRENDERMAN
    @XRENDERMAN Před 3 měsíci +19

    With runes svelte loses the main advantage - super concise syntax. How is this different from Vue now?

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +3

      It doesn't suck. /s

    • @johnmishell234
      @johnmishell234 Před 3 měsíci

      Did you watch the video?

    • @anarcus
      @anarcus Před 3 měsíci +7

      ​@@JoyofCodeDevno but really, how's it any different from Vue now?

    • @daleryanaldover6545
      @daleryanaldover6545 Před 3 měsíci

      ​@@anarcusvue this vue that, vue SFC came from svelte and signals from solid.

    • @anarcus
      @anarcus Před 3 měsíci +4

      @@daleryanaldover6545 sure, taking inspiration is great, but that doesn't answer the question of why would Svelte be different from Vue now

  • @flaviopinnelli2158
    @flaviopinnelli2158 Před 3 měsíci +1

    How are named slots going to work in svelte 5?

  • @moussadotco
    @moussadotco Před 3 měsíci +27

    This looks like the reactification of svelte ... unfortunate to see

    • @adriansanchezr.8508
      @adriansanchezr.8508 Před 3 měsíci +9

      Agree! Huge fan of Svelte from the very beginning, and now it's like if I could hear the React guys saying "I told you. You can't skip the state[ ] syntax". Oh boy, they were right! :(

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +9

      It's fine if you don't like it but you should learn how the tools you use work because If you knew how React works compared to other frameworks you would know how ridiculous that sounds.

    • @moussadotco
      @moussadotco Před 3 měsíci +1

      @@JoyofCodeDev hahaha. Ok 🙌

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci +8

      Maybe you guys should realize that writing Javascript instead of $: is the correct way and other people where right, just learn javascript and stop complaining about React, this update is not a “Reactification” this is a “Javascriptization” my friend

    • @ionutale1950
      @ionutale1950 Před 3 měsíci

      @@ivan.jeremicyet “$:” is JavaScript , is called “label”.

  • @jsonkody
    @jsonkody Před 3 měsíci +8

    I think people loved Svelte for it's super short & easy syntax .. w8 does Svelte just becoming Vue3? 😅
    Well I am already using Vue so no need to change 😊

  • @ReViv4L
    @ReViv4L Před 3 měsíci +10

    No one will ever convince le children are better than slots. I dont mind the state and derived syntax, but this is a huge setback

    • @forno_nicolas
      @forno_nicolas Před měsícem

      was one of the most painful thing to grab for me... The logic is just wacky

  • @Jeff-co.
    @Jeff-co. Před 3 měsíci +8

    IMO there's nothing new here that you wouldn't find in any other framework that came before Svelte. I mean, Svelte's cool and all but... I see no reason why I should stop using something like Vue. There's just no advantage at all on making the switch. This all just looks like everything else we've had to learn before many times but with different syntax. The cycle never ends smh.

  • @guillermohinostroza1016
    @guillermohinostroza1016 Před měsícem +3

    I used Svelte 4 for a lot of projects, the last one is a custom CRM for an international logistic company, so I'm talking as an experienced developer not a youtube tutorial maker.
    I don't like Svelte 5, sad because I'm a huge fan of Svelte (the old good one) besides I script React, Vue and Alpine, but Svelte (and recently Alpine) are really enjoyable to code, at least for me.
    Maybe my first reaction about the new version is visceral, but in contrast with the first time I met Svelte and instantly started to play with it, this new version makes me apathic. And the changes are massive and some of them unnecessary -once again, it's my personal opinion-, just figuring upgrade my last project (some thousands of codelines) is disturbing.
    The old Svelte had its own personality, that's why a lot of developers loved him but this one is lost pretending to be at times React and others Vue.

  • @vickmackey24
    @vickmackey24 Před 3 měsíci +4

    14:50 For most cases, I don't think the new `{@render children()}` will be any better or easier than slots, but it does add some flexibility.

    • @jeffreysmith9837
      @jeffreysmith9837 Před 3 měsíci

      We get snippets which we really need. Single file components suck

  • @garlandcrow
    @garlandcrow Před 3 měsíci +6

    lol does vercel sponsor this channel now? I like your vids man but how can you show examples and usage of how it’s objectively worse but then just say at the end: ah but it’s not that bad you’ll get used it and it’s just fantastic 😂

  • @user-iz2xk1yx6r
    @user-iz2xk1yx6r Před 3 měsíci

    I was asking myself today, like 3 hours ago when will svelte 5 be released as i have a couple of problems that were so hard to implement a solution for in a project im working on and i dont want to invent signals (although i have a library for them that was made sometime ago) hopefully i dont have to wait too much to be able to use them in production

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci

      A lot of people already do. 😂

    • @daleryanaldover6545
      @daleryanaldover6545 Před 3 měsíci

      ​@@JoyofCodeDevwas wondering about it as well, I've migrated kit a while ago. So it's safe to say I can use svelte 5 preview now?

  • @Eloii_Xia
    @Eloii_Xia Před 3 měsíci +6

    Since the 'let' keyword is supposed to denote mutability, I think '$state()' is nonsensical in some way. However, in the end, the idea of signals is a better approach (without being the best in my opinion). It could be nice to have : signal name = "john" instead of let name = "john"

    • @diegoulloao
      @diegoulloao Před 3 měsíci +1

      I agree

    • @arshiagholami7611
      @arshiagholami7611 Před 3 měsíci +1

      signal name = "john" is not a valid js code

    • @Eloii_Xia
      @Eloii_Xia Před 3 měsíci

      @@arshiagholami7611 I know. It's an example

    • @sam_sam_sam
      @sam_sam_sam Před 3 měsíci +1

      @@arshiagholami7611 let name = $state("john") is not valid js code either. $state() is only valid to the svelte 5 compiler because they transform it into valid js code. signal name = "john" could be perfectly valid if the svelte team wanted to go that route. They probably went with $state() instead because it looks like a normal JavaScript function so it feels familiar to people

    • @W4nn3
      @W4nn3 Před 3 měsíci

      ​@@sam_sam_sam `signal name = "john"` is not valid js syntax. `let name = $state("john")` is valid js syntax.

  • @zBrain0
    @zBrain0 Před 3 měsíci

    When you say custom stores are not necessary does that mean they will eventually be unsupported? I've been able to do some pretty clever things with custom stores. I'm still transitioning my brain around the new changes, I think it's natural for humans to resist change but from my perspective I will tend to defer to people that have probably used it in a lot more complex ways than I have and have learned where it's pitfalls are.

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci

      You have a lot of time because they're going to be deprecated in future versions.

  • @zochy
    @zochy Před 3 měsíci +1

    Love the video, and btw what browser are you using?
    nvm just realised its brave after rewatching :P

  • @SRG-Learn-Code
    @SRG-Learn-Code Před 3 měsíci +15

    13:50 Okay, I see now I'm not going to miss the old syntax of events. And holly molly those props... so clean, so beautiful.

    • @thehumankinds
      @thehumankinds Před 3 měsíci +3

      For sure $props is good ! But what is this example ? I mean, who used the eventDispatcher like this in svelte 4 ? You could do the exact same stuff, just passing the functions as props no ? I did at least (Asking for a friend)

    • @xintaur5725
      @xintaur5725 Před 3 měsíci +1

      ​@@thehumankinds Yea, the example is misleading. This is not a new feature in Svelte 5, I am often doing the same thing in Svelte 4.
      Not to mention that this method of passing around event handlers can get really convoluted with deeply nested / sibling components...

  • @MaxHDeveloping
    @MaxHDeveloping Před 3 měsíci +16

    so svelte is vue 3 now?

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +5

      No, it's way better.

    • @MaxHDeveloping
      @MaxHDeveloping Před 3 měsíci +20

      @@JoyofCodeDevidk man, feels like vue with extra steps

    • @nuttbaked
      @nuttbaked Před 3 měsíci +1

      so when vue ditches virtual dom it'll be svelte?

    • @everythingisfine9988
      @everythingisfine9988 Před 3 měsíci +3

      ​@@MaxHDeveloping work with both. Svelte is 👑

    • @diegoulloao
      @diegoulloao Před 3 měsíci +4

      exactly, looks like just vue with changes

  • @user-on2rx4si7g
    @user-on2rx4si7g Před 3 měsíci +4

    Finally New vidéeo ❤❤❤❤❤❤

  • @exponent42
    @exponent42 Před 3 měsíci +6

    Sniff sniff who’s there? Confirmation bias

  • @EliSpizzichino
    @EliSpizzichino Před 3 měsíci +2

    This are huge changes to the API, I'll have to rewrite all of my apps and components! Are they backward compatibles?
    I hope some translator 4->5 will exist

  • @zhanezar
    @zhanezar Před 3 měsíci

    i wonder if the LIGHTSWITCH puzzle from the old video is easier in svelte 5

  • @sotasanta
    @sotasanta Před 27 dny

    Svelte 5 looks extremely promising for large and complex applications. I am very excited for the future of Svelte! 🎉

    • @draco_2727
      @draco_2727 Před 5 dny

      It looks like it's maturing or getting closer to Vue now 😂

  • @justin8mux
    @justin8mux Před 3 měsíci +14

    awesome and simple?! ... it's looks the opposite, miss the old syntax. God please don't let our Svelte we love to turn into "react-like" monster

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci +2

      This is simple, these are just javascript functions so you are telling me it is hard for you to write javascript?

    • @justin8mux
      @justin8mux Před 3 měsíci +3

      @@ivan.jeremic thnx for your feedback. It doesn't matter how name it, but it looks more verbose and complex compare to Svelte4. Javascript might look more or less complex, it depends how we use it. Syntax simplicity of Svelte3/4 is a big deal, it is one of the key features for a wider adoption.

    • @workflowinmind
      @workflowinmind Před 3 měsíci +2

      @@ivan.jeremic I think most of those comments are just people that did not actually tried it. I was kind of replused by it until I migrated a "complex" project, now I'm in love

  • @io1921
    @io1921 Před 3 měsíci +1

    Do you have a video on how svelte compiler works?

  • @vitorguidorizzzi7538
    @vitorguidorizzzi7538 Před měsícem

    As a vue3 enjoyer i like what im seeing, the dolar sign syntax has a few footguns for non trivial reactivity

  • @Antonio-fo4fl
    @Antonio-fo4fl Před 3 měsíci +4

    One important thing I think missed in templating is the fact that you can now use typescript in the markup

  • @dailynews7822
    @dailynews7822 Před 8 dny

    What browser using on it ?

  • @superwin06
    @superwin06 Před 3 měsíci +2

    Can we use these new syntax also in sveltekit?

  • @local9
    @local9 Před 3 měsíci +2

    I've only recently started using Svelte, so I'm glad this is coming in at this time.

  • @hiteshrohira7968
    @hiteshrohira7968 Před 3 měsíci

    Wait do you have tab groups in firefox somehow????

  • @blokche_dev
    @blokche_dev Před 3 měsíci +2

    Class transformation seems like magic to me 😅. And callbacks as argument don't sound as web oriented as events.
    Snippets are powerfull but slots are a web standard as well, which translate pretty well from a framework to another.
    Both events and slots are used in vue for example and are pretty decent choices.
    But Svelte is still a pleasure to work with. 💙

  • @Champs3443
    @Champs3443 Před 2 měsíci

    I love when he says "how beautiful is this

  • @TzAwY2012
    @TzAwY2012 Před 3 měsíci +8

    switching back to react and next, svelte and sveltekit will die after this update, nice one svelte team!

    • @jub0bs
      @jub0bs Před 3 měsíci +4

      I predict that this comment will age poorly. 😇

  • @AlanDanielx
    @AlanDanielx Před 3 měsíci

    What happened with the outro?

  • @grenadier4702
    @grenadier4702 Před 3 měsíci +6

    I'd suggest use runes only if needed and mostly stick to the old syntax
    for example, working with arrays or using custom stores

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +3

      That's going to be deprecated.

    • @pointer333
      @pointer333 Před 3 měsíci +2

      Why?

    • @grenadier4702
      @grenadier4702 Před 3 měsíci

      @@JoyofCodeDev sadge. I hope svelte is going in right direction with these changes

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +4

      I wouldn't make this video if I didn't love the changes but that doesn't mean you have to and I'm vocal about things I don't like as an ambassador but the Svelte team is always listening and proxied state is one example that solved most problems people had with runes and paves the way for the future.

  • @AlexanderDemin
    @AlexanderDemin Před 3 měsíci +1

    Where are snippets examples?

  • @Metruzanca
    @Metruzanca Před 3 měsíci

    I love how svelte 5 is basically implementing solidjs' signals.

    • @mariogutierrez4989
      @mariogutierrez4989 Před 3 měsíci +1

      Not to take anything away from Solid, signals have been around a long time. Knockoutjs made it popular.

    • @erickmoya1401
      @erickmoya1401 Před 3 měsíci

      And thats amazing. Solid copied the idea of being compiled from Svelte. Svelte took signals from knockout popularized by solid.

  • @greendsnow
    @greendsnow Před 3 měsíci +5

    Slots were good... 😢

  • @shableep
    @shableep Před 3 měsíci +5

    Love your videos but have one small hang up. You cover the fundamentals of understanding javascript and I absolutely love that. But when working with Svelte you often say that “it’s just javascript”. But that’s not accurate and is actually misleading because Svelte is presenting functionality, behavior and syntax that does not exist in javascript. I’m not saying that’s bad, but I think since you cover the importance of fundamentally understanding the javascript you write, it’s then equally important to be clear about how Svelte files are not “just javascript”. I think Svelte is great, but people should appreciate and understand when it isn’t javascript, and why that is actually, more often than not, a good thing.

  • @pranjalmenaria3919
    @pranjalmenaria3919 Před 3 měsíci

    Other than render() I see no problem with Svelte 5. I think it is an upgrade but I'm going to stick with my beloved Vue till they figure things out.

  • @figloalds
    @figloalds Před 3 měsíci +10

    Yo the on:click|preventDefault is miles superior to this crap new syntax, did not like that change at all
    Also dislike the $props() change, it sucks a lot
    The old is significantly simpler too

    • @ionutale1950
      @ionutale1950 Před 3 měsíci +1

      Yesssssssss.
      This is exactly what I don’t like.
      Also $effect…
      Hate it

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci

      This crap new syntax is called JavaScript and you should learn it before jumping into frameworks.

    • @ionutale1950
      @ionutale1950 Před 3 měsíci +3

      @@ivan.jeremic i don't get why you are upsed with me?
      also, old syntax was JS as well

    • @figloalds
      @figloalds Před 3 měsíci

      ​@@ivan.jeremic I know JavaScript all too well, I know the syntax and I know destructuring, and it's fucking ugly.
      It also loses the ability to have optional props with a default value

    • @ivan.jeremic
      @ivan.jeremic Před 3 měsíci +1

      @@ionutale1950 it was not it was Svelte language.

  • @RhUmbUs
    @RhUmbUs Před 3 měsíci +11

    I can't express how much i'm disappointed with all these changes. Not a single new positive. Alot of syntax substitution for very little seeming benefit. The magic that made Svelte so unique in its domain is now being dissolved in favor of chewy programmatic syntax that seem to be influenced heavily by react devouts. I'm beginning my mourning 😓

    • @whatisamodel8252
      @whatisamodel8252 Před 2 měsíci +1

      Everything becomes react eventually.

    • @mursie100
      @mursie100 Před 2 měsíci +1

      You know svelte 4 is not going anywhere right?

    • @RhUmbUs
      @RhUmbUs Před měsícem

      @@mursie100 eventually it will. And the nature of the direction of Svelte 5 and its reception will dictate the trajectory for successive versions.

  • @kylerjohnson988
    @kylerjohnson988 Před 3 měsíci +13

    I’m excited for these changes. They address all of the pain points you end up encountering when you build anything non-trivial with Svelte.

    • @mbokil
      @mbokil Před 3 měsíci +2

      I agree the older reassignment and quirky syntax in 4 had issues. I use React and Vue more but I really like the Runes syntax and will start using Svelte 5 when it is stable.

    • @workflowinmind
      @workflowinmind Před 3 měsíci +1

      Same! I wasn't a fan when they announced it but after updating a project to it I'm sold!

    • @ReViv4L
      @ReViv4L Před 3 měsíci

      Could anyone who tried this update elaborate on the advantages of $render over slot ? Genuinely asking

    • @TheVertical92
      @TheVertical92 Před 3 měsíci

      @@ReViv4LAs far as i have played with it, there is no advantage. The advantage of Svelte 5 are the Snippets that can be used with @render

    • @kylerjohnson988
      @kylerjohnson988 Před 3 měsíci

      @@ReViv4L render isn’t a replacement for slots. They have two different use cases. The Render API allows you to insert a snippet into a section of your view while a slot allows you to project content into the views of other components. Snippets are named pieces of your template that you define that aren’t rendered by default. Like an ng-template if you’re familiar with angular at all.

  • @tonymercier6812
    @tonymercier6812 Před 3 měsíci +5

    I hate everything about it, might actually drop svelte
    I also don't like how you keep saying "oh it's really great- something something", but you don't provide a reason or a benefit. this all seems like a regression to me

  • @negativerfan
    @negativerfan Před 3 měsíci

    14:53: And named slots?

  • @dave-7117
    @dave-7117 Před 3 měsíci +1

    I really like that svelte is moving to signals, they just out perform every other reactivity system and are so simply to understand. But i dont understand the svelte team want to hide the signal logic. Im talking about something like `const count = $state(0)` where count will be an object with a value getter and setter. Just like vue does it. I see that its shorter to omit the .value but if you ever want to use $state inside a factory like in your counter example you need to invent some workarounds (which the svelte team did pretty good, but there still is a learning curve).
    I absolutely love svelte and use it since v3 came out, but this is a thing i dont get.

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci

      It's because it can be replaced by something else.

    • @shableep
      @shableep Před 3 měsíci

      I think this is an ergonomics vs clarity compromise. A framework, at the end of the day, is a consensus of conventions and ideas between a large community of people with diverse sensibilities. People seem to generally value visual simplicity over being detailed. I think the lack of clarity that you’re dealing with state (getters/setters/value) is a loss. But if it creates a framework that me and someone that doesn’t think like me can agree on, then we’re on to something.

  • @1337H4KZ
    @1337H4KZ Před 3 měsíci

    is sveltekit updated to use theese changes?

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci +1

      You can use it with `npm i svelte@next`.

  • @urban248
    @urban248 Před 3 měsíci +1

    I am just learnign js and what the absolute fuck ! How am I not able to just append a value to the end of the list?! Without reinstating the whole list?! HOW AWESOME! I might as well write whole web app in C, JavaScript GOD TIER mhm

  • @cristophermoreno2290
    @cristophermoreno2290 Před měsícem +1

    💔 it's evolving ....backwards.

  • @Novaliz78
    @Novaliz78 Před 3 měsíci +1

    I hope you are making a slower tutorial to svelte 5 because this video is simply too fast for me who learned svelte 4 4 month ago :)

    • @JoyofCodeDev
      @JoyofCodeDev  Před 3 měsíci

      This was just a casual look comparing the features, but when it's released I'm going to make more in-depth videos. You don't have to be concerned about relearning everything because most things look the same but are easier. 😄

    • @Mexad0n
      @Mexad0n Před 3 měsíci +1

      I love your videos but I agree that you are talking too fast to understand (technically) what you are talking about and follow the rest . I usually have to stop and rewind back several times on some of these or just slow down the play speed. ;) Thank you for your hard work.

  • @MZ-yx8eg
    @MZ-yx8eg Před měsícem +1

    Whats next ? Virtual dom?

  • @Rioni
    @Rioni Před 3 měsíci +2

    I understand these decisions but they're not for me, Svelte 5 made me go to Vue3, I still use Svelte 4 for quick prototypes and simple projects

  • @SRG-Learn-Code
    @SRG-Learn-Code Před 3 měsíci +2

    7:50 I'm not amused by svelte making getters and setters for me. I'll know they are there and that might be a gateway drug to use Java.

  • @kamalkamals
    @kamalkamals Před 3 měsíci

    for reactivity similar little bit to qwik js, nop ?

  • @meisam3dfoxh467
    @meisam3dfoxh467 Před 3 měsíci +5

    Slot is good
    Why are you doing that?

  • @whoknows3679
    @whoknows3679 Před 3 měsíci +2

    Now svelte is vue

  • @probablykasper
    @probablykasper Před 3 měsíci +2

    I don't like $props at all. If you want to safely specify the type for one of the props, you'll have to write 2x the amount of lines.

  • @naranyala_dev
    @naranyala_dev Před 3 měsíci

    more advanced state management cases

  • @dustin6336
    @dustin6336 Před 3 měsíci

    The counter example threw me.

  • @hnriq
    @hnriq Před 3 měsíci +2

    This makes Svelte much clearer IMO. I've worked on a relatively large project using Svelte 4 and many issues I had around readability and typing issues would be fixed by some of these changes. Also, before it felt too magic for me and that was pretty awkward, now it looks concise, clean and not an odd witchcraft. Also, spreading event listeners is HUGE. What I do miss is a way to do better unit tests.

  • @TempusGPT
    @TempusGPT Před 3 měsíci +1

    I really like these changes but the dollar sign is so ugly

  • @mamertvonn
    @mamertvonn Před 28 dny

    It looks like vue setup function

  • @davidsiewert8649
    @davidsiewert8649 Před 3 měsíci +1

    Still no Intellij IDE Support?
    I tried switching to Svelte but found it a much worse experience because of vscode.
    Vscode refactoring just sucks (if you get used to something like Intellij).
    The Svelte-Plugin in Intellij is stuck /only compatible with svelte version 3.

    • @erickmoya1401
      @erickmoya1401 Před 3 měsíci +1

      How so?
      I use webstorm and things go fine.

    • @davidsiewert8649
      @davidsiewert8649 Před 3 měsíci

      Thanks.
      Latest version really seemed to have improved.
      Currently testing it...