Why are people SO obsessed with useSignal()?

More about what signals are, how they work, and how you can use them in our full blog post: www.builder.io/blog/usesignal...
#javascript #react

Пікірлер: 146

  • @Steve8708
    @Steve8708 Жыл бұрын

    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

    Жыл бұрын

    Thank you for correcting yourself in the comment here :)

  • @stephenisienyi7726

    @stephenisienyi7726

    7 ай бұрын

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

  • @fifty-plus

    @fifty-plus

    5 ай бұрын

    Except you might want to not shadow the variable.

  • @user-ud8hw4gp6t

    @user-ud8hw4gp6t

    2 ай бұрын

    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 Жыл бұрын

    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

    Жыл бұрын

    Rather the exercise of the memory i'd say

  • @nawfelbengherbia8302

    @nawfelbengherbia8302

    Жыл бұрын

    React also keeps us warm in the winter ^^

  • @nero1375

    @nero1375

    Жыл бұрын

    @@nawfelbengherbia8302 you mean more CPU cycles? hehehe

  • @muhammadmejanulhaque3305
    @muhammadmejanulhaque3305 Жыл бұрын

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

  • @drizzletone9148
    @drizzletone9148 Жыл бұрын

    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

    5 ай бұрын

    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

  • @tuttsj
    @tuttsj Жыл бұрын

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

  • @alexiscalabera8314
    @alexiscalabera8314 Жыл бұрын

    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!

  • @eddyk564
    @eddyk564 Жыл бұрын

    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

    Жыл бұрын

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

  • @Corrup7ioN

    @Corrup7ioN

    Жыл бұрын

    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

    Жыл бұрын

    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.

  • @ken6737
    @ken6737 Жыл бұрын

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

  • @mjarkk
    @mjarkk Жыл бұрын

    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

    Жыл бұрын

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

  • @chandragie
    @chandragie Жыл бұрын

    Clear & simple explanation!

  • @sherifsalah5563
    @sherifsalah5563 Жыл бұрын

    Svelte does it out of the box

  • @naranyala_dev
    @naranyala_dev Жыл бұрын

    Very clear explanation, thank you

  • @brayancuenca6925
    @brayancuenca6925 Жыл бұрын

    Keep up the great content!

  • @Francois3k
    @Francois3k Жыл бұрын

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

  • @150-150
    @150-150 Жыл бұрын

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

  • @JosephCaburnay
    @JosephCaburnay Жыл бұрын

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

  • @adambickford8720
    @adambickford8720 Жыл бұрын

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

  • @baxalasse
    @baxalasse Жыл бұрын

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

  • @grinsk3ks
    @grinsk3ks Жыл бұрын

    2:39 yeah vue was not forgotten =)

  • @jeanpierredelacruz8946

    @jeanpierredelacruz8946

    6 ай бұрын

    Is Vue way performant than React in 2023? Just asking

  • @SomoeBlog
    @SomoeBlog Жыл бұрын

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

  • @lawrencejob
    @lawrencejob Жыл бұрын

    I miss RXJS

  • @dinaiswatching
    @dinaiswatching Жыл бұрын

    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

    Жыл бұрын

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

  • @TheSaceone
    @TheSaceone Жыл бұрын

    angular dev here, waiting for signals :)

  • @AmxCsifier
    @AmxCsifier Жыл бұрын

    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

  • @MrHauntedLollipop
    @MrHauntedLollipop Жыл бұрын

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

  • @user-mr1sr2rv1w
    @user-mr1sr2rv1w Жыл бұрын

    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()}

  • @dinijalil6107
    @dinijalil6107 Жыл бұрын

    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.

  • @xxXAsuraXxx
    @xxXAsuraXxx Жыл бұрын

    svelte is the best

  • @jacoblockwood4034
    @jacoblockwood4034 Жыл бұрын

    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

    Жыл бұрын

    Observer pattern

  • @jacoblockwood4034

    @jacoblockwood4034

    Жыл бұрын

    @@charlesm.2604 Mixed them up, thanks

  • @lionardo
    @lionardo11 ай бұрын

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

  • @yeargun5582
    @yeargun5582 Жыл бұрын

    🔥🔥🔥

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

  • @nguyentrieu3607
    @nguyentrieu3607 Жыл бұрын

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

  • @brucearmstrong5536
    @brucearmstrong5536 Жыл бұрын

    Angular is implementing this in it's next release v16

  • @icarusgk
    @icarusgk Жыл бұрын

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

  • @cedi2929

    @cedi2929

    Жыл бұрын

    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"

  • @michaelchen163
    @michaelchen163 Жыл бұрын

    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.

  • @theodorosvragkos6752
    @theodorosvragkos6752 Жыл бұрын

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

  • @genechristiansomoza4931
    @genechristiansomoza49316 ай бұрын

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

  • @albiceleste101
    @albiceleste101 Жыл бұрын

    I'm a freelancer, switched to Svelte this year

  • @albiceleste101

    @albiceleste101

    2 ай бұрын

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

  • @valikonen
    @valikonen Жыл бұрын

    This will be also part of Angular

  • @thegrumpydeveloper
    @thegrumpydeveloper Жыл бұрын

    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

    Жыл бұрын

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

  • @alexandreg.1000
    @alexandreg.1000 Жыл бұрын

    It is so similar to what Vue does :D

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

  • @user-mr1sr2rv1w

    @user-mr1sr2rv1w

    Жыл бұрын

    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.

  • @mises1615
    @mises1615 Жыл бұрын

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

  • @hyunbinseo
    @hyunbinseo Жыл бұрын

    There is a typo - Coutn

  • @gasparsigma
    @gasparsigma7 ай бұрын

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

  • @herman751
    @herman751 Жыл бұрын

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

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

    Жыл бұрын

    He's working on Qwik, not React.

  • @rahiyansafin449
    @rahiyansafin449 Жыл бұрын

    Soon Angular? What are they doing?

  • @mikopiko
    @mikopiko Жыл бұрын

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

  • @himesh_89
    @himesh_89 Жыл бұрын

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

  • @AlanDanielx
    @AlanDanielx4 ай бұрын

    Can RemixJs use signals?

  • @dongums
    @dongums Жыл бұрын

    hmmm similir with svelte

  • @skl9942
    @skl9942 Жыл бұрын

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

  • @ajfalo-fi3721

    @ajfalo-fi3721

    Жыл бұрын

    Yes

  • @Steve8708

    @Steve8708

    Жыл бұрын

    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 👍👍

  • @TheGryphon14
    @TheGryphon14 Жыл бұрын

    hello jQuery

  • @thepetesmith
    @thepetesmith Жыл бұрын

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

  • @iamcasted
    @iamcasted Жыл бұрын

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

  • @victors16811
    @victors16811 Жыл бұрын

    This is why I use mobx instead

  • @emmanuelolowu6768
    @emmanuelolowu6768 Жыл бұрын

    The signal is basically like refs? I guess?

  • @mikeonthebox
    @mikeonthebox8 ай бұрын

    2:24 setInterval is never accurate anyway to begin with, right? 1000 doesn't guarantee it will run every second.

  • @user-ge2vc3rl1n
    @user-ge2vc3rl1n Жыл бұрын

    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

    Жыл бұрын

    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

    Жыл бұрын

    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

    Жыл бұрын

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

    Жыл бұрын

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

  • @fifty-plus
    @fifty-plus5 ай бұрын

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

  • @drastik67
    @drastik67 Жыл бұрын

    Coutn

  • @theanswer1993
    @theanswer1993 Жыл бұрын

    React is really outdated at this point.

  • @LarsRyeJeppesen
    @LarsRyeJeppesen Жыл бұрын

    useSignal? lol

  • @zerocodefx1698
    @zerocodefx1698 Жыл бұрын

    Jargon Thrashing is Lame

  • @namename8986
    @namename89867 ай бұрын

    what is hydrate

  • @branquitodemunze
    @branquitodemunze Жыл бұрын

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

  • @hunterwilhelm

    @hunterwilhelm

    Жыл бұрын

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

  • @lord_kh4n

    @lord_kh4n

    Жыл бұрын

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