Svelte Runes Change How Reactivity Works In Svelte

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 241

  • @JoyofCodeDev
    @JoyofCodeDev  ปีที่แล้ว +75

    I forgot to mention these changes aren't out yet and even when they release them it's opt-in and your Svelte components are going to work as usual.

  • @weecl
    @weecl ปีที่แล้ว +14

    as a beginner I learned a little bit of react, vue, and svelte but eventually picked svelte because it’s reactive system feels the most natural to me (and plus it’s compiled). so I’m glad I can keep using the easy basic stuff for 90% of my layouts and use runes for when I need a bit more control

    • @tom400iq6ft
      @tom400iq6ft ปีที่แล้ว +5

      not forever. they’ll deprecate and remove eventually :P

  • @GrantGryczan
    @GrantGryczan ปีที่แล้ว +17

    For those not a fan of this: `$state` is just a compiler hint! It doesn't actually affect the value of the variable _at all._ The variable still literally equals its value. If you do `let count = $state(0)`, then `count === 0` will be true. It's the `count` variable itself that becomes reactive, not its value. If you assign its value to a different variable, its reactivity isn't copied.
    *I'm still not a fan of the `$state(...)` syntax because it doesn't make that clear at all.* Due to this common confusion, I think putting runes on the right-hand side of the equal sign was the wrong move, since it has nothing to do with what the variable is being set to. This would be much clearer and simpler imo:
    let $count = 0;
    Then it clearly communicates it's the variable that's reactive, not its value. And as a bonus, then dollar signs would explicitly indicate everywhere reactivity is present in your app. (But then you'd also have to think of better syntax for `$derived` which has the same problem.)

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +1

      That's right because `$state` is not a function but a keyword.

    • @AShaheen92
      @AShaheen92 ปีที่แล้ว +1

      I see $state is not valuable enough right now but may be in future when they get rid of reactivity for right hand of equal sign only $state will be reactive which will improve performance as other lets will not be considered for reactivity
      Another thing though being to write $count will be much complicated with these reserved keywords as I think they will introduce more runes to the system

    • @GrantGryczan
      @GrantGryczan ปีที่แล้ว +2

      @@AShaheen92 `$derived` would need a different syntax too (which I think it should anyway). And `$effect` could just be named something else without the dollar. Either of those would apply to any future runes. The dollar's nice for clarity that it's a compiler hint, but I'd argue clarity that variables are reactive is more important.
      Or at least move the syntax somewhere else on the left-hand side. Like why not more labels? Labels could just as well be extended to work universally (both inside and outside `.svelte` files).

    • @AShaheen92
      @AShaheen92 ปีที่แล้ว +1

      @@GrantGryczanyou have good point it is matter of time to understand what is going on

  • @tom400iq6ft
    @tom400iq6ft ปีที่แล้ว +16

    This looks..... not that good

    • @Snozcumber
      @Snozcumber ปีที่แล้ว +5

      I worry that now there's a whole team working on svelte it'll get over complicated like react. Rich basically got svelte right on his own

  • @nickstaresinic4031
    @nickstaresinic4031 ปีที่แล้ว +14

    Cool name, Runes, but at first blush -- no, I haven't used it yet -- it looks like a layer of React-ish complication added on top of a *beautifully* simple and performant system. (Perhaps because it doesn't solve any problems I've encountered.)

  • @tomich20
    @tomich20 ปีที่แล้ว +126

    Reactivity in Svelte 6: import {$useState} From Svelte; const [count, setCount] = $useState(0);

  • @benocxx7906
    @benocxx7906 ปีที่แล้ว +10

    I'm really looking forward to using those runes! I really liked the $props rune it seems so useful to create reusable and flexible components! Way better than the current prop system imo

  • @vutruong4164
    @vutruong4164 ปีที่แล้ว +6

    Signal is 1st class citizen in SolidJs. Vue has a similar Signal implementation under the hood.
    Angular has been using RxJS /Observable for a long time for asynchronous reactivity, and recently added Signal for synchronous reactivity. They also interops, so best of both worlds.
    Now Svelte joins the party. It seems all frameworks are converging on the trend of fine-grain reactivity.

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +3

      This is the way.

    • @MrEnsiferum77
      @MrEnsiferum77 ปีที่แล้ว

      But developers hate rxjs, how now they started loving it... or is just rxjs under the hood so now looks cool...

    • @vutruong4164
      @vutruong4164 ปีที่แล้ว

      ​@@MrEnsiferum77 not all developers hate RxJS, it has its place in the ecosystem.
      I had to learn it for an Angular project, and ended up loving it. It unlocks a really declarative/reactive way of writing code, i.e. you "see" the dependencies of your state, its lifecycle, its side-effects, etc right at the point you "declare" that state.
      You no longer need to jump thru a bunch of function references to see what are the initial value of your state, what states your state depend on, what states depend on your state, its side effects ...
      Of course, due to its async nature, RxJS is overburdened with async-centric operators that are rarely used. I would say you'll need only 10-15% of those rxjs operators to be productive.
      Signal, on the other hand, is "synchronous" reactivity, with only 2-3 operators like $derived (aka computed signal), $effect, and probably $mutate. It will be much easier to use.
      The benefit that most people seem to be missing is that Signal should make Svelte more efficient, by using the very $effect of a Signal to surgically target the DOM node that needs to be updated, whenever that source Signal mutates.
      Svelte compiler will no longer need to rely on "=" overloading and "$:" blocks for compiled reactivity, addressing some edge case bugs

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      @@MrEnsiferum77 Signals are not the same as RxJS observables.

    • @MrEnsiferum77
      @MrEnsiferum77 ปีที่แล้ว

      @@JoyofCodeDev What's the difference, observer pattern just under the hood, and miminal primitives to accomodate observable state as signals, runes or u put name u like. give me all the money in the world and I look like building something new...

  • @MichaelNinoEvensen
    @MichaelNinoEvensen ปีที่แล้ว +2

    Fantastic run-through! Super clear and a perfect balance between existing and new features.

  • @adomelka
    @adomelka 11 หลายเดือนก่อน +4

    Why not make the variable identifier as the reactive state declaration? Was it discussed/proposed?
    let $count = 0
    let $derivedDouble = $count * 2
    Not only does it make the code shorter, but it also makes it clear what variable is a signal or derived later in code.

  • @gageracer
    @gageracer ปีที่แล้ว +11

    Having 2 ways to write svelte apps will be a problem in short term. If this is the new way they want to go with adding more verbs, then we should get rid of old $ reactivity thing. Also I did not get the reason to have untrack for $effect or nested $effect's.

    • @jrmc732
      @jrmc732 ปีที่แล้ว +1

      that's normal for every library, not a single lib in the world can have one way forever, the only way of doing this is to not change anything.

    • @willsterjohnson
      @willsterjohnson ปีที่แล้ว

      Looks like these are coming in Svelte 5, so the old system will probably be deprecated but still work. Maybe in Svelte 6+ the old reactivity system will be removed

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +6

      It's going to be removed in the future.

    • @brad1785
      @brad1785 ปีที่แล้ว +3

      @@willsterjohnson they said in the FAQ that there will be warnings in 6 and removal in 7.

    • @brad1785
      @brad1785 ปีที่แล้ว +3

      I agree. If they think this is the way to go, just make everybody convert to it now.

  • @Naton
    @Naton ปีที่แล้ว +2

    i dont get it, what's wrong with the current store system? why add unnecessary magical function

  • @Dev-Siri
    @Dev-Siri ปีที่แล้ว +11

    I don't care about the runes, I just care about how much faster my app is going to become now.

  • @maninalift
    @maninalift ปีที่แล้ว +3

    The one thing i really didn't get, that you didn't talk about and neither did Rich Harris really, is what is the point in nesting effects? He said that it helped you to not clutter your top level, bit i suspect there is more to it than that.

    • @-ion
      @-ion ปีที่แล้ว +2

      Rich's video had an example of where you'd want that: when you use the outer $effect as an onMount, create a variable within it (his example had "const ctx = canvas.getContext('2d')"), and want another reactive $effect to use it. Without nesting the $effects you would need to move that variable into the parent scope of the first $effect *and* make it mutable and nullable.

  • @nooalovern
    @nooalovern ปีที่แล้ว +5

    If i hear "how beautiful is this friends" one more time, I swear.

  • @jesper.ordrup
    @jesper.ordrup ปีที่แล้ว +1

    Love your videos. Always covers a topic really well in a nice tempo and a happy friendly optimistic voice. 😊
    This one is also good. Examples are working but imho could be much simpler to easily explain the main points of runes 🎉

  • @ZalexMusic
    @ZalexMusic ปีที่แล้ว +5

    What a 5 to be alive

  • @nanashi7726
    @nanashi7726 ปีที่แล้ว +6

    Thank you for creating this video! Your video gives me awsome infos!
    BTW, 5:24 , I think the `const count` at 11 line shold be `counter` maybe

  • @snapphanen
    @snapphanen ปีที่แล้ว +3

    So svelte is closing in on classic java 1.6 or something with all these setters and getters-

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +3

      That's why it's named JavaScript. 😂

  • @medbenbrahim3246
    @medbenbrahim3246 ปีที่แล้ว

    Great video, I was a bit worried about the signals overhead cost in SSR,
    Svelte team took that into consideration and signals have no cost on server side as they don't need to be reactive

  • @brad1785
    @brad1785 ปีที่แล้ว +15

    If it's not like React, it shouldn't use the same term as React.
    This whole thing is a big miss by the Svelte maintainers. I've never run into any of the issues brought up, so for me all I get out of this is having to write a ton more boilerplate code that makes my Svelte components look more like React components.

    • @RyuuuGamingUnlimited
      @RyuuuGamingUnlimited ปีที่แล้ว +3

      L take.

    • @jingle1161
      @jingle1161 ปีที่แล้ว +6

      I agree. This doesn't look very intuitive.

    • @RisalFajar
      @RisalFajar ปีที่แล้ว

      It's good to have a universal term, that way developers don't have to memorize lots of different terms.

    • @senseicodes
      @senseicodes ปีที่แล้ว +1

      You have no idea how much advanced svelte stuff people are writing, if you don't have a need for it, others will. Simplifying state in a simple component without needing to reach for stores or context is a win.

    • @brad1785
      @brad1785 ปีที่แล้ว

      @@senseicodes notice I said nothing about other people running into those issues. My entire comment is about how it makes things less simple in components that are not extremely complicated.

  • @UliTroyo
    @UliTroyo ปีที่แล้ว +10

    My mind is already racing with how much ugliness in my projects I'm going to be able to clean up. I have so many winding reactive statements and one-shot stores and `onMount`s.

    • @wobsoriano
      @wobsoriano ปีที่แล้ว

      I will now be able to clean up my ugly a** useEffect implementation

  • @qeqsiquemechanical9041
    @qeqsiquemechanical9041 ปีที่แล้ว +8

    Meh, modern web is a massive unusable bloat, and this wont make it better

  • @EliSpizzichino
    @EliSpizzichino ปีที่แล้ว +1

    This runes my day

  • @jingle1161
    @jingle1161 ปีที่แล้ว

    Completely off topic:
    I LOVE your video thumbnails.

  • @greendsnow
    @greendsnow ปีที่แล้ว +17

    how beautiful is this friends?

  • @Kevin192291
    @Kevin192291 ปีที่แล้ว

    That was a lot to take in, but I can already see how it can solve a few problems I have had for some time now.

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      I tried to keep it simple! 😄

  • @dunkTheFunk
    @dunkTheFunk ปีที่แล้ว +2

    quite hard to get my head round but seems legit

  • @jhonyortiz5
    @jhonyortiz5 ปีที่แล้ว

    I still don't get effect. It also seems somewhat similar to derived except that it's for blocks of code?

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +1

      It's roughly equivalent to `$:` and is used to run code whenever specific values change, or when a component is mounted to the DOM.

  • @combinio9533
    @combinio9533 ปีที่แล้ว

    Very good video. Great explanation, thanks!

  • @evanfuture
    @evanfuture ปีที่แล้ว +1

    You got this out faaaast!

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      It took me a couple of days! 😄

  • @snk-js
    @snk-js 9 หลายเดือนก่อน

    i have tested the snippet on 8:00 and this break the app:
    Uncaught Error: ERR_SVELTE_TOO_MANY_UPDATES: Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops.

  • @IAmOxidised7525
    @IAmOxidised7525 ปีที่แล้ว +3

    In future will they depreacate stores and $: statement ? Feels that way

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      Yeah! 😄

    • @anti5895
      @anti5895 ปีที่แล้ว

      by using runes, stores become optional so yeah those will be deprecated for sure.

    • @senseicodes
      @senseicodes ปีที่แล้ว +1

      I don't think stores will be deprecated, they are still great for storing data components can subscribe to and render.

  • @salman4430
    @salman4430 ปีที่แล้ว +1

    Explained better than the docs. no cap!

  • @copytopgrade6458
    @copytopgrade6458 ปีที่แล้ว

    great explain. loved it

  • @naranyala_dev
    @naranyala_dev ปีที่แล้ว

    it's like a global function, and we don't need to import, so it's provided by the compiler, am i right?

  • @dexter-wy5bo
    @dexter-wy5bo ปีที่แล้ว

    would be good to know at least a release timeframe… as in, should i start a new app that would really benefit from this in v4 and refactor later or just wait?

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      There is none yet.

    • @dexter-wy5bo
      @dexter-wy5bo ปีที่แล้ว

      @@JoyofCodeDev 😒

    • @senseicodes
      @senseicodes ปีที่แล้ว +1

      Start now, refactor later.

    • @dexter-wy5bo
      @dexter-wy5bo ปีที่แล้ว +1

      @@senseicodes found it in the FAQ - it’s “later this year…hopefully” and a pre-release for the brave even sooner.

  • @isdeonf
    @isdeonf ปีที่แล้ว

    Awesome video!

  • @lateAutumn314
    @lateAutumn314 ปีที่แล้ว

    What about the $props rune? 🤔

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +1

      The `$props` rune replaces `export let` but I only wanted to talk about reactivity.

  • @ste-fa-no
    @ste-fa-no ปีที่แล้ว

    Great video!

  • @PowBro
    @PowBro ปีที่แล้ว

    Finally...Svelte rocks

  • @kulemantu
    @kulemantu ปีที่แล้ว

    Just realising if I haven’t yet written wrapper functions for writeable stores I’m very much a Svelte toddler 😅

    • @kulemantu
      @kulemantu ปีที่แล้ว

      I’m sold!

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +1

      It's more advanced. 😄

  • @RyuuuGamingUnlimited
    @RyuuuGamingUnlimited ปีที่แล้ว

    niceeee 🔥

  • @oleksii7899
    @oleksii7899 ปีที่แล้ว +8

    yes but how is it different from the 10-years-old react?

    • @TitoMitto
      @TitoMitto ปีที่แล้ว

      It doesn't have useFootGun()

    • @raenastra
      @raenastra ปีที่แล้ว +2

      uses signals instead of virtual DOM. if you want a comparison, it's closer to solid than react

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +5

      It's named Svelte.

    • @doublekamui
      @doublekamui 10 หลายเดือนก่อน +1

      That is different from React useState, React useState doesn't use signals. The signal concept was popularized by SolidJS, then adopted by various frameworks, including Vue, Svelte, Qwik.
      Signals can prevent the entire re-rendering of components, offering fantastic performance benefits by updating values without re-rendering the entire component.
      So, it's worth considering this advantage in performance. So, delve into the concepts first, not just concluding similarities based on external appearances.

  • @maninalift
    @maninalift ปีที่แล้ว

    You made this quickly

  • @v01d69
    @v01d69 ปีที่แล้ว +1

    Second! Yess sir

  • @yabdelm
    @yabdelm ปีที่แล้ว +1

    Why can't they just pack this into their compiler or make it so we don't have to repeat ourselves so much, it's so freaking verbose, annoying, confusing:
    `get count() { return count },
    set count(value) {count = value},
    get double() { return double}`

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      They can make it simpler! 😄

  • @Miles-co5xm
    @Miles-co5xm ปีที่แล้ว +4

    Svelte 4 is awesome, svelte 5 is just becoming react 😢😢

    • @doublekamui
      @doublekamui 10 หลายเดือนก่อน

      That is different from React useState, React useState doesn't use signals. The signal concept was popularized by SolidJS, then adopted by various frameworks, including Vue, Svelte, Qwik.
      Signals can prevent the entire re-rendering of components, offering fantastic performance benefits by updating values without re-rendering the entire component.
      So, it's worth considering this advantage in performance. So, delve into the concepts first, not just concluding similarities based on external appearances.

  • @kanways8
    @kanways8 ปีที่แล้ว

    its looks like bit complicated. now its simpler

  • @raenastra
    @raenastra ปีที่แล้ว

    I'm glad everyone's collectively agreeing that signals are the way to go for reactivity

    • @brad1785
      @brad1785 ปีที่แล้ว +4

      I do not agree.

    • @raenastra
      @raenastra ปีที่แล้ว

      @@brad1785 By "everyone", I mean the major frameworks. Angular is moving to signals as well.

  • @viniciusmachadorodrigues1724
    @viniciusmachadorodrigues1724 ปีที่แล้ว +3

    i really dislike $ signs, it looks awful

  • @Nukhtarov
    @Nukhtarov ปีที่แล้ว +1

    First!

  • @ArunRajOnline
    @ArunRajOnline 7 หลายเดือนก่อน

    Svelte ruined.. 🤦

  • @olivierboisse1678
    @olivierboisse1678 ปีที่แล้ว

    It should have been called useState and useEffect instead of $state and $effect

    • @doublekamui
      @doublekamui 10 หลายเดือนก่อน

      That is different from React useState, React useState doesn't use signals. The signal concept was popularized by SolidJS, then adopted by various frameworks, including Vue, Svelte, Qwik, and React (useSignal from the Preact package).
      Signals can prevent the entire re-rendering of components, offering fantastic performance benefits by updating values without re-rendering the entire component.
      So, it's worth considering this advantage in performance. So, delve into the concepts first, not just concluding similarities based on external appearances.

  • @LucasAlexK
    @LucasAlexK ปีที่แล้ว +58

    This was just announced!! How did you make such a good video so fast? 😍
    Great job on separating what is standard JS is what is new to Svelte

    • @nuttbaked
      @nuttbaked ปีที่แล้ว

      he had a beta access or something probably and was already working on a video

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +32

      I'm a Svelte ambassador. 😎

    • @nyashachiroro2531
      @nyashachiroro2531 ปีที่แล้ว +2

      ​@@JoyofCodeDevFlex 💪😅

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +2

      @@nyashachiroro2531 💪

    • @miketierce
      @miketierce ปีที่แล้ว

      @@JoyofCodeDev I’m just gonna highjack this to ask you if Svelte is ready for large production projects yet? I’ve got a codebase I have to move off Nuxt2 and I’ve been eyeballing Svelte instead but don’t want to be in the same place 3 years from now

  • @jingle1161
    @jingle1161 ปีที่แล้ว +7

    This doesn't look like we're getting more simplicity 🤔

  • @shrin210
    @shrin210 ปีที่แล้ว +5

    now Solidjs looks good
    why $derived and all that 😂

  • @smithrockford-dv1nb
    @smithrockford-dv1nb ปีที่แล้ว +12

    One thing bothers me with the effect rune: if I were to use two variables, but only want to run the effect when one updates-but not the other-how can I do that? In react I would just not include it in the dependency array, but here?

    • @brandonstelog1557
      @brandonstelog1557 ปีที่แล้ว +1

      I'm curious about this as well. But doesn't the old solution($: {code()}) have this exact problem?

    • @Александр-ч4п5ъ
      @Александр-ч4п5ъ ปีที่แล้ว

      +++

    • @human0id
      @human0id ปีที่แล้ว

      @brandonstelog1557 no, because you would have only referenced the variables you want to react to
      $: handleChange(count)

    • @jrmc732
      @jrmc732 ปีที่แล้ว +1

      You create nested effects I guess.

    • @jrmc732
      @jrmc732 ปีที่แล้ว +4

      Also your example has no real world use-case, if your effects uses variables it should run when any of them changes, your example is not an example for the real world, the is no situation where you want to run the effect is just one changes, you can have multiple effects for that.

  • @alwayzsmarter
    @alwayzsmarter ปีที่แล้ว +5

    Is there a release time estimate yet? Its still confusing to me but after i watch 20 videos about it and get my hands dirty with it over the next month ill have the 🤯 moment as always occurs

  • @funnynews341
    @funnynews341 ปีที่แล้ว +3

    Well i feel a guy from reactjs will make svelte more complicated. Now svelte not simple, harder to use and learn than reactjs, maybe we should learn reactjs

  • @niklasw3196
    @niklasw3196 ปีที่แล้ว +6

    How awesome is this 🔥

  • @DanielRios549
    @DanielRios549 ปีที่แล้ว +2

    This is a bit strange, I will need more time to get rid of the old reactivity system, this is a lot of React like, and React is boring

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +2

      It reminds me more of Solid and Vue because of how similar the API looks and signals are used in almost every framework but React.

  • @alwayzsmarter
    @alwayzsmarter ปีที่แล้ว +4

    5:24 i think this is supposed to be const counter =
    (But doesnt hurt our understanding so its fine)

  • @Huntabyte
    @Huntabyte ปีที่แล้ว +3

    Should be illegal to post this video so early. Kinda like insider trading😏. Seriously though, great breakdown🔥

  • @IainSimmons
    @IainSimmons ปีที่แล้ว +2

    Looks... solid. 😉

  • @yitzchaksviridyuk932
    @yitzchaksviridyuk932 ปีที่แล้ว +2

    This looks great, but this is basically what Vue 3 has had for a long time if I'm not mistaken. Just maybe without the effect rune. Need to double check if there's some equivalent to that.

    • @sigveha
      @sigveha ปีที่แล้ว

      watch and watchEffect are the Vue equivalents:)

    • @yitzchaksviridyuk932
      @yitzchaksviridyuk932 ปีที่แล้ว

      @@sigveha Thanks! But can you do nested watches?

    • @alisherdotdev
      @alisherdotdev ปีที่แล้ว

      @@yitzchaksviridyuk932 What you mean by nested watches?

    • @yitzchaksviridyuk932
      @yitzchaksviridyuk932 ปีที่แล้ว

      @@alisherdotdev Well, in the video, you see Matt defining an $effect within an $effect. I assume that this means that you can have some effects that are dependent on other effects. I'm not sure what the use case for this would be, but since we're just trying to figure out what the equivalent to $effect would be in Vue, I was just trying to double check how similar watch is to $effect. Just checked right now btw, and yeah, you could also do nested watches in Vue... Definitely something to avoid in my opinion, but anyway, seems like Vue 3 had all this stuff all along, with the same precision, etc.

  • @pascaltib
    @pascaltib ปีที่แล้ว +1

    Amazing video! This was much better explained than the official docs and the svelte team videos!

  • @anti5895
    @anti5895 ปีที่แล้ว +3

    I dig all these improvements. tried it and looks like I am writing react, which make me vomit all night. what next, JSX coming in 6? great vid as always btw

  • @nullquest
    @nullquest 7 หลายเดือนก่อน

    The syntax is terrible
    If i wanted to use react, I would use react.

  • @kadirzukorlic3304
    @kadirzukorlic3304 11 หลายเดือนก่อน

    How beautiful is this, friends?

  • @alpap6234
    @alpap6234 ปีที่แล้ว

    smells like react

  • @dasten123
    @dasten123 ปีที่แล้ว +10

    Back in the day I looked at all those frameworks and went with Vue... seeing this here made me really happy that I apparently made the right decision back then.
    This reactivity system does really not look good to me.

    • @dasten123
      @dasten123 ปีที่แล้ว

      @@Niiju Cause it's so much magic and not Javascript at all

    • @PanosPitsi
      @PanosPitsi ปีที่แล้ว +4

      @@dasten123imagine thinking vanilla js is a good language 🥶🥶🥶

    • @jrmc732
      @jrmc732 ปีที่แล้ว

      Svelte before was magic and not JavaScript, you Svelte devs are confused.@@dasten123

    • @raenastra
      @raenastra ปีที่แล้ว +2

      ​@@dasten123 signals are the most predictable, least magical form of reactivity we've got, which is why everyone's switching to them

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +1

      I'm happy for you! 😄

  • @P4INKiller
    @P4INKiller ปีที่แล้ว

    7:44 If it's a cleanup function, why does it run every time count changes?

  • @avi12
    @avi12 ปีที่แล้ว +8

    Svelte is getting needlessly complicated

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +2

      Have you tried it?

    • @johnmishell234
      @johnmishell234 ปีที่แล้ว +1

      This makes it easier instead of more complicated

    • @realderek
      @realderek ปีที่แล้ว +1

      I appreciate that there's now a consistent way to handle state, whether it's in a Svelte component or a separate file. That's a big win. However, if I'm understanding this correctly, for complex applications that have several values per $state, this is going to add a ton of boilerplate with lots of getters and setters.

  • @Methapon2001
    @Methapon2001 ปีที่แล้ว

    Will there ever be a vdo without 'how beautiful is this' 😅😅
    I like it tho!!!

  • @guhkunpatata3150
    @guhkunpatata3150 11 หลายเดือนก่อน

    as always your video and explanation are great! thanks for the great content!

  • @mylastore
    @mylastore 4 หลายเดือนก่อน

    Do current stores need to be rewritten using Runes and state declaration?

    • @JoyofCodeDev
      @JoyofCodeDev  4 หลายเดือนก่อน +1

      you can use stores but they're going to be deprecated in the future

    • @mylastore
      @mylastore 4 หลายเดือนก่อน

      Thanks, I updated my app to Svelte 5 but as soon as update a store to utilize runes the rest of the files also need to be updated you can’t mixed both.

  • @mdshehab8947
    @mdshehab8947 ปีที่แล้ว

    Easy explaination

  • @alikreznik4520
    @alikreznik4520 ปีที่แล้ว +2

    I escaped to sveltekit from react only for sveltekit to become react

  • @SoreBrain
    @SoreBrain ปีที่แล้ว

    Signals finally!

  • @justingolden87
    @justingolden87 ปีที่แล้ว

    Man that was fast

  • @sukiidx3503
    @sukiidx3503 ปีที่แล้ว

    Are there any drawbacks using the new runes compared to the let statements? Performance between these two? Are there times you would want to use the let statements instead of the new runes?

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      You don't have to think about it because signals are going to be the only reactive system.

  • @j.m.manhard
    @j.m.manhard ปีที่แล้ว

    Jesus you are fast! Rich showed it 4 hours ago and your video is already up for 45minutes 😂

  • @rotrooney
    @rotrooney ปีที่แล้ว

    Suppose you want to pass a parameter into increment, how would you do it?

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว

      You just pass it as a function argument.

  • @kiana5066
    @kiana5066 ปีที่แล้ว

    so can I use any of these rune thingies to calc something in {#each} blocks or am I still limited to doing all this in the tag?

    • @senseicodes
      @senseicodes ปีที่แล้ว +2

      You use the @const to do a quick calc and your result is returned to your @const variable

    • @kiana5066
      @kiana5066 ปีที่แล้ว +1

      @@senseicodes**impostor syndrome intensifies** 😳 thank you SO MUCH

  • @Nikolafesb
    @Nikolafesb ปีที่แล้ว

    One newbie question, can svelte do everything react or next can?

    • @leopb21
      @leopb21 ปีที่แล้ว +5

      Yes. Much better. React re-renders everything like crazy by default. You need to verbose your code in React by implementing "memos" workarounds if you want to run a list with 200 component instances with sort, filter and transitions. React just fails to keep things running smoothly by default. It's the worst architecture among the biggest frameworks. However, the most used.

    • @jrmc732
      @jrmc732 ปีที่แล้ว +5

      Don't listen to this beginner above me... react is fine and next too.

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +2

      You can't go wrong picking either one.

    • @leopb21
      @leopb21 ปีที่แล้ว +7

      Don't listen to me. Just implement a simple test in React: Write a styled card component, put some transitions and try to sort and filter a list of 200 instances. "Oh, you need to use memo!". Yes! native workaround for bad architecture.

    • @jrmc732
      @jrmc732 ปีที่แล้ว

      @@leopb21 I see you know nothing about how svelte lists internally work and that they are inefficient, if you would have listened to Rich Harris Runes presentation you would have heard exactly that and that Rich himself admits this. And that is exactly the problem with beginner mentality just like teenagers in their worst years they think they already know everything and no one should try explaining to them why things are how they are. I'm not even a "Only React" guy, I use many techs besides that like Solid or Vue but your dumb comment made me just sad that people like you with 0 understanding of how Frameworks work under the hood want to prove themselves here in the youtube comments.

  • @parlor3115
    @parlor3115 ปีที่แล้ว +1

    Wow, having finally been exposed to Svelte's syntax, I realized why it never took off, because it's sh*t

    • @JoyofCodeDev
      @JoyofCodeDev  ปีที่แล้ว +4

      Thank you for your insight.

    • @senseicodes
      @senseicodes ปีที่แล้ว +2

      Why svelte never took off? Have you been living under a rock?