Svelte Runes Change How Reactivity Works In Svelte

Поділитися
Вставка
  • Опубліковано 21 січ 2025

КОМЕНТАРІ • 240

  • @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 Рік тому +15

    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 Рік тому +6

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

  • @LucasAlexK
    @LucasAlexK Рік тому +59

    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

  • @nickstaresinic4031
    @nickstaresinic4031 Рік тому +13

    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.)

  • @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

  • @MichaelNinoEvensen
    @MichaelNinoEvensen Рік тому +2

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

  • @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

  • @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.

  • @pascaltib
    @pascaltib Рік тому +1

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

  • @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...

  • @tomich20
    @tomich20 Рік тому +127

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

  • @niklasw3196
    @niklasw3196 Рік тому +6

    How awesome is this 🔥

  • @tom400iq6ft
    @tom400iq6ft Рік тому +16

    This looks..... not that good

    • @sausageroll6979
      @sausageroll6979 Рік тому +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

  • @adomelka
    @adomelka Рік тому +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.

  • @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 🎉

  • @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.

  • @IainSimmons
    @IainSimmons Рік тому +2

    Looks... solid. 😉

  • @ZalexMusic
    @ZalexMusic Рік тому +5

    What a 5 to be alive

  • @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.

  • @EliSpizzichino
    @EliSpizzichino Рік тому +1

    This runes my day

  • @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

  • @guhkunpatata3150
    @guhkunpatata3150 Рік тому

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

  • @jingle1161
    @jingle1161 Рік тому

    Completely off topic:
    I LOVE your video thumbnails.

  • @Naton
    @Naton Рік тому +2

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

  • @P4INKiller
    @P4INKiller Рік тому

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

  • @Huntabyte
    @Huntabyte Рік тому +3

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

  • @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

  • @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.

  • @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

  • @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.

  • @evanfuture
    @evanfuture Рік тому +1

    You got this out faaaast!

  • @jingle1161
    @jingle1161 Рік тому +7

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

  • @combinio9533
    @combinio9533 Рік тому

    Very good video. Great explanation, thanks!

  • @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

  • @nooalovern
    @nooalovern Рік тому +5

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

  • @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.

  • @mylastore
    @mylastore 8 місяців тому

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

    • @JoyofCodeDev
      @JoyofCodeDev  8 місяців тому +1

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

    • @mylastore
      @mylastore 8 місяців тому

      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.

  • @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.

  • @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. 😂

  • @copytopgrade6458
    @copytopgrade6458 Рік тому

    great explain. loved it

  • @hello_world_104
    @hello_world_104 Рік тому +4

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

  • @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.

  • @hello_world_104
    @hello_world_104 Рік тому +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

  • @snk-js
    @snk-js Рік тому

    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.

  • @isdeonf
    @isdeonf Рік тому

    Awesome video!

  • @ste-fa-no
    @ste-fa-no Рік тому

    Great video!

  • @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

  • @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.

  • @j.m.manhard
    @j.m.manhard Рік тому

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

  • @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?

  • @PowBro
    @PowBro Рік тому

    Finally...Svelte rocks

  • @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.

  • @lateAutumn314
    @lateAutumn314 Рік тому

    What about the $props rune? 🤔

    • @JoyofCodeDev
      @JoyofCodeDev  Рік тому +1

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

  • @shrin210
    @shrin210 Рік тому +5

    now Solidjs looks good
    why $derived and all that 😂

  • @RyuuuGamingUnlimited
    @RyuuuGamingUnlimited Рік тому

    niceeee 🔥

  • @dunkTheFunk
    @dunkTheFunk Рік тому +2

    quite hard to get my head round but seems legit

  • @mdshehab8947
    @mdshehab8947 Рік тому

    Easy explaination

  • @greendsnow
    @greendsnow Рік тому +17

    how beautiful is this friends?

  • @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.

  • @salman4430
    @salman4430 Рік тому +1

    Explained better than the docs. no cap!

  • @Methapon2001
    @Methapon2001 Рік тому

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

  • @qeqsiquemechanical9041
    @qeqsiquemechanical9041 Рік тому +8

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

  • @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! 😄

  • @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.

  • @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.

    • @shining_cross
      @shining_cross Рік тому +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.

  • @SoreBrain
    @SoreBrain Рік тому

    Signals finally!

  • @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

  • @kadirzukorlic3304
    @kadirzukorlic3304 Рік тому

    How beautiful is this, friends?

  • @maninalift
    @maninalift Рік тому

    You made this quickly

  • @v01d69
    @v01d69 Рік тому +1

    Second! Yess sir

  • @kulemantu
    @kulemantu Рік тому

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

  • @justingolden87
    @justingolden87 Рік тому

    Man that was fast

  • @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.

  • @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}`

  • @alikreznik4520
    @alikreznik4520 Рік тому +2

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

  • @Miles-co5xm
    @Miles-co5xm Рік тому +4

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

    • @shining_cross
      @shining_cross Рік тому

      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

  • @avi12
    @avi12 Рік тому +8

    Svelte is getting needlessly complicated

    • @JoyofCodeDev
      @JoyofCodeDev  Рік тому +2

      Have you tried it?

    • @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.

  • @alpap6234
    @alpap6234 Рік тому

    smells like react

  • @nullquest
    @nullquest 11 місяців тому

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

  • @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.

  • @Nukhtarov
    @Nukhtarov Рік тому +1

    First!

  • @olivierboisse1678
    @olivierboisse1678 Рік тому

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

    • @shining_cross
      @shining_cross Рік тому

      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.

  • @viniciusmachadorodrigues1724
    @viniciusmachadorodrigues1724 Рік тому +3

    i really dislike $ signs, it looks awful

  • @ArunRajOnline
    @ArunRajOnline 11 місяців тому

    Svelte ruined.. 🤦

  • @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?