Why are people SO obsessed with useSignal()?

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ม.ค. 2025

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

  • @Steve8708
    @Steve8708  ปีที่แล้ว +65

    Small but important correction - in these trivial examples you *can* use setCount(count => count + 1) to get around one issue I showed (assuming your code is that simple/trivial)
    In the real world this is not always an option though, the article shows better examples that demonstrate more properly: www.builder.io/blog/usesignal-is-the-future-of-web-frameworks

    • @Microphunktv-jb3kj
      @Microphunktv-jb3kj ปีที่แล้ว

      extreme performance and javascript in the same sentence...
      on what kind of drugs are you on ?

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

      Thank you for correcting yourself in the comment here :)

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

      Great job, Steve. Greater job still for the correction. Shows sincerity.

    • @fifty-plus
      @fifty-plus 11 หลายเดือนก่อน

      Except you might want to not shadow the variable.

    • @lameshithead
      @lameshithead 9 หลายเดือนก่อน

      hmm the entire component doesnt need to rerender if you return it in a hook using dependencies, so wheres the difference to signals? i guess with signals you can have call the (lets say) signalhook directly without using an extra dependency, but does it work faster? i dont think so. and you cant use signals without statesand more than one component, so theres the same issue with async and statemutation

  • @pupfriend
    @pupfriend ปีที่แล้ว +100

    I like React because it exercises the browser with rerenders. It's like browser calisthenics so the browser stays fit. I don't want by browser getting fat.

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

      Rather the exercise of the memory i'd say

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

      React also keeps us warm in the winter ^^

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

      @@nawfelbengherbia8302 you mean more CPU cycles? hehehe

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

    I love how you simply start the video with subtitles and finish the video without doing some unnecessary stuff. Loved the content

  • @drizzletone9148
    @drizzletone9148 ปีที่แล้ว +27

    It's funny how something that has been present in Vue for a really long time now is depicted as something revolutionary :D

    • @chuksjr.1440
      @chuksjr.1440 ปีที่แล้ว

      Popularity never always means better!

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

      It's been present in react long before this video, but it's popularity exploded when people realized you could do things useState can do but 40% faster

  • @eddyk564
    @eddyk564 ปีที่แล้ว +67

    The way Solid JS should really be the norm in my opinion. React was build to deal with a UI that was constantly being updated, which is not the case with most web apps. It's odd that the React way as seen as normal and the Solid JS way is seen as revolutionary

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

      It’s still lipstick on a pig compared to Svelte imho

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

      I used (and loved) KnockoutJS before React came out. It used a vaguely similar approach to singals which led me to always believe the whole virtual DOM diffing thing was kinda dumb, yet it was quickly accepted as being normal. KnockoutJS came out years before react and was by no means perfect, but I wish its approach was improved upon over all these years rather than largely forgotten until now.

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

      Stencil does something very similar to signals with their state decorator

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

      ​​@@bradyfractal6653 your comment should be pinned!

    • @charlesm.2604
      @charlesm.2604 ปีที่แล้ว +10

      What bothers me the most is JSX.
      - It makes it real hard to do separation of concerns between UI layer and business logic.
      - Event handlers. I always wondered why they don't add a history parameter to the callback like they do with state setters. That's yet an other entry on the long list of React's inconsistencies.
      - JSX is supposed to be a HTML DSL yet you end up using more JS in your templates for some reason.
      - There is no built-in CSS DSL so you end up with bad implemented CSS-in-JS librairies and utilities CSS, the man who thought it was a good idea is a masochist.
      When a common return statement look like this how long does it takes before you start to question wether your fancy library is solving an issue or is causing a completely new problem ?
      return (
      {TodoStore.todos.map(item => (
      {item.text.replace("x", "y")}
      {item.isCompleted && (
      TodoStore.removeOne(item.id)}>
      Remove
      )}
      )
      That's why I would choose Vue over React any time, the directive-based templating.
      And I'd obviously prefer Angular at work but the lead forces us to work with React.

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

    I love the content you put out Steve. So concise and well presented. Keep up the awesome work 🙌🏻

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

    I tipically never comment, but damn, you present stuff that actually matters in a really easy and enjoyable manner. 5 minutes ago I didn't know or care about this, now I do and it's interesting af!

  • @mjarkk
    @mjarkk ปีที่แล้ว +44

    You don't have to add count to the useEffect dependencies if you make setCount a function with count as argument setCount(count => count + 1)

    • @ajfalo-fi3721
      @ajfalo-fi3721 ปีที่แล้ว

      do you even read comments before posting?

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

      @@ajfalo-fi3721What are you talking about? @mjarkk is correct, and I didn’t see any other comments yet pointing this out. Nothing wrong with the truth being stated more than once, unless you want to hide it.

    • @ajfalo-fi3721
      @ajfalo-fi3721 ปีที่แล้ว

      @@peterbalogh5622 see the pined comment from Steve

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

    Love this content format. Simple, concise, and more importantly, it provides bite-sized information for viewers.

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

    Hey Steve, nice video!
    What tool and method did you use to generate your subtitles? They look great!

  • @sherifsalah5563
    @sherifsalah5563 ปีที่แล้ว +9

    Svelte does it out of the box

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

    Clear & simple explanation!

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

    Man u are the G.O.A.T. u made this topic so easy to digest. Keep up the firee content man!!!!!

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

    Do you have a video about svelte? I'd like to hear your insights about it

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

      @@alex-craft yeah svelte is less boilerplaty than solid + i prefer the templating of svelte over jsx. I was already accustomed to it through smarty and twig etc

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

    I hope you continue on liking what you do and provide us more good contents like this. Thank you so much. :)

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

    Very clear explanation, thank you

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

    Straight talk: Its RxJs with training wheels. Of course its simpler, its solving a much easier problem.

  • @dkazmer2
    @dkazmer2 6 หลายเดือนก่อน

    So is it better to hydrate or to dry?

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

    2:39 yeah vue was not forgotten =)

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

    How does it perform when dealing with arrays that are rendered?

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

    Like RH says, "As enginers, we should be offended". Checkout Svelte instead.

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

    It is something that we can now use with ReactJS + Vite properly?

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

    Question for you since you do deep dives, and have a general interest in learning. What are your thoughts on code assessments vs take homes for assessing a candidate's talent?

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

      In my experience, having a candidate do a small home assessment and then mob/pair program with the candidate to is the best way of finding out what level they are

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

      @@creamy_gavin Completely agree, and you get a sense of how they name, do they test, and how well they abstract and simplify the code. I wish more people like you were hiring.

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

    What do you mean by more code to download? Whole React gets shipped in case of SSR anyway

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

    is there a sharable state management for components in qwik.js?

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

    Thanks again, Steve. I've fallen in love with this framework, but one thing concerns me, though. I'm quite aware of the $qwikfy function, but ideally it would be best if we had some UI qwik libraries, done in the qwik way, don't you agree?

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

      There's a group of people working on exactly that!

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

    Can RemixJs use signals?

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

    I miss RXJS

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

    Keep up the great content!

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

    Soon Angular? What are they doing?

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

    2:38 Vue was mentioned LETSGOOO, I feel it gets left out most of the time, thank you.

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

      The "Vue way" is ref() correct?

    • @charlesm.2604
      @charlesm.2604 ปีที่แล้ว

      ​@@cedi2929 With Vue you use Watchers, the API looks like this:
      watch(dependency, callback)
      The dependency can be any type, ref, reactive, getter function, array, etc... And the callback can be asynchronous or synchronous.

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

      @@cedi2929 Yess, ref() and reactive() are Vue's fine-grained "signals"

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

    im a but confuse, so this signal thing is a solidJS only method ? and can we use it in react app ? 0:51 is that a solid js app or a react app ?
    is it possible to use signal in a react app ?

    • @IAM-v5p
      @IAM-v5p ปีที่แล้ว

      Ryan Carniato, creator of Solid JS, has been on an evangelical mission to introduce the concept of signals to the javascript community, which is being adopted by a lot of other frameworks.

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

    Ah yes, we going full circle aren't we I remember "laser beam the value directly into dom" at 2001!

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

    Thanks for explaining that the hype isn't around something new--just that the rest of the JS community rediscovered the pub-sub model that has been around since the 90s lol

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

      To be clear, I think signals are good--it's just odd that they haven't been around for longer. I wrote something of a wrapper around the DOM api at one point that utilized a construct very close in semantics to signals, but I never really maintained it since I shortly after learned about Solid.

    • @charlesm.2604
      @charlesm.2604 ปีที่แล้ว +1

      Observer pattern

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

      @@charlesm.2604 Mixed them up, thanks

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

    I'm a freelancer, switched to Svelte this year

    • @albiceleste101
      @albiceleste101 8 หลายเดือนก่อน

      ​@@aamorous Now I use both Svelte and Next, depends on the project
      Next probably easier due to the React ecosystem but Svelte nicer to code in

  • @user-ge2vc3rl1n
    @user-ge2vc3rl1n ปีที่แล้ว +1

    Okay, but what does hydrate mean? You're saying that as if its a commonly used term and I've only heard it in redux.

    • @charlesm.2604
      @charlesm.2604 ปีที่แล้ว +3

      Hydration basically means that instead of shipping your whole JS code in one bundle you have multiple chunks, so the browser only has to download the code for the content that's currently on the page.

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

      In UI frameworks, hydration is a process where JavaScript code attaches itself to HTML that was sent from the server. It means JS doesn't need to rebuild whole UI again, but rather for example it can just attach event handlers to appropriate DOM nodes for that existing HTML (in case of React). It still has to run some code to actually do all that, but it doesn't need to rebuild the whole UI from scratch because it already exists, so hydration is less work compared to rendering full from scratch.
      What Charles M. said in his comment above is not hydration, but rather code splitting. This can be used for delayed hydration so that you only hydrate certain parts of UI when they become relevant. I think Astro does this a lot and you can tell it to only hydrate (load and run JS) for a certain part of the UI when you scroll to it for example.
      I guess in context of Redux it might be sending Redux store with existing data from server to browser and then just reuse that state on client. I'm not sure, haven't used Redux for a very long time.

    • @user-ge2vc3rl1n
      @user-ge2vc3rl1n ปีที่แล้ว

      @@rand0mtv660 thanks for the responses

    • @charlesm.2604
      @charlesm.2604 ปีที่แล้ว +1

      @@rand0mtv660 That's partially true. Hydration's goal is to offer the possibility of modifying a view client side that was server rendered.
      In a meta-framework, the server generates the HTML, ships it to the client and the client side takes over, hydrating the page content upon state changes.
      Those event handlers you talked about aren't explaining what hydration is, they're explaining one implementation of it.

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

      @@charlesm.2604 Yeah that's why I mentioned for example it can attach event handlers. I was mostly referring to React implementation since I'm most familiar with that one. The point I tried to make is that hydration doesn't have anything to do with many smaller JS bundles (code splitting) and you can have hydration with a single monolithic JS bundle that isn't code split at all. They are two different things that don't have to be used together at all.

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

    Dude, U should try Deepsignals, the upgraded version of Signals.

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

    Hello,
    can you help us with more Fine-Grained and deep discussion for signal.
    I can see quick and solid js, is more Fine-Grained Reactivity, less expensive and give fast performance.
    Why not angular so much

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

    There is a typo - Coutn

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

    Who works on React that they have not had "signals" till now?

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

    angular dev here, waiting for signals :)

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

    So it's like a useRef but it triggers a re-render of where it's used? Interesting

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

    There’s no doubt that things are more performant but I don’t believe that the framework makes or breaks an app. With the sheer volume of react apps in production it’s clear to me that any performance gains from frameworks like solid likely won’t matter at the end of the day unless my use case is in the critical path of what solid is great for.

    • @2penry2
      @2penry2 ปีที่แล้ว

      I Agree, It's impressive to see these new frameworks. But for me react is good enough.

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

    Angular is implementing this in it's next release v16

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

    Shouldnt count be a function in solid.js? "Count is {count()}"

    • @ajfalo-fi3721
      @ajfalo-fi3721 ปีที่แล้ว

      Yes

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

      Technically it can be {count} (only in the DOM, when used directly in JS like `const double = count() * 2` you need the parens. But I think it's more idiomatic to use {count()}

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

      Oh cool, I didn't know that. Your videos are absolute golden. Thank you for the effort, its most appreciated 👍👍

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

    This will be also part of Angular

  • @IAM-v5p
    @IAM-v5p ปีที่แล้ว

    You forgot to call count as a getter . . typeof count is Accessor. To access the value you need to call it:
    setCount(count() + 1)}>
    Count is {count()}

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

    🔥🔥🔥

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

    Can we get a PAID frontend Reactjs course from you where you only teach about performance related stuffs? It will blow up the internet for sure.

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

      He's working on Qwik, not React.

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

    Hope react will take this as a signal 😂 to support this natively. Valtio is the close but not quite to supporting this type of behaviour but it really would be nice to be built in.

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

      react would have to fundamentally change as a framework for that to happen which is very very unlikely

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

    The more mature qwik get, the more interested I become.

  • @alexandreg.1000
    @alexandreg.1000 ปีที่แล้ว

    It is so similar to what Vue does :D

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

    For the interval example you can do the same in React by passing a function to setstate.

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

    Who the hell updates state in react by accessing state variable directly😭😭😭😭😭😭

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

    Solid is what React should have been. I am worried that our app will start to be doggy.

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

    The signal is basically like refs? I guess?

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

    If you every create a course on React, i will be the first one to jump inm

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

    I'm not aboard the 'signal' train. I can see the benefit if you're new to React or don't have much experience or a good understanding of the fundamentals. I feel like it's just syntactical sugar for useState with useContext or something along those lines. I'd rather just implement that myself so half my team doesn't have to study some 3rd party library.
    For this example, wouldn't simply returning a function to setCount solve this problem i.e. setCount( count => count + 1)? Either way, you shouldn't ever be setting a useState variable directly in it's setter. Always wrap it in a function and pass is the old state variable as a param as shown above.

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

    hmmm similir with svelte

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

    hello jQuery

  • @fifty-plus
    @fifty-plus 11 หลายเดือนก่อน

    When you fix a leaky abstraction you remove the bugs and nuance that it introduced ... and React hooks are very leaky.

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

    React is really outdated at this point.

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

    This is why I use mobx instead

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

    Coutn

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

    Jargon Thrashing is Lame

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

    useSignal? lol

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

    what is hydrate

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

    these frameworks are each time worse than before, it's such a mess, fixing issues that are wrong by design

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

      What's the right design? Wrong implies the existence of right

    • @z-aru
      @z-aru ปีที่แล้ว

      @@hunterwilhelm Let's gooo, please ratio the OP