When Should We (NOT) Use a Signal effect()?

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

КОМЕНТАРІ • 55

  • @BenjaminAyala-u3l
    @BenjaminAyala-u3l Місяць тому +6

    Me thinking I already knew all the signals APIs... then Debora comes and shows me so much more insights I didn't know... Thank you

  • @seanszarkowicz
    @seanszarkowicz Місяць тому +1

    Great video as always!! Love the decision tree at the end

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Thanks! 😊

    • @seanszarkowicz
      @seanszarkowicz Місяць тому

      @@deborah_kurata your videos are the best because you go over use cases and more real world example by making API requests

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Thank you so much!
      Some content creators have suggested "shorter is better". While that may generate more views, I think it's important to cover more use case details. So I'm never quite able to keep the videos as short as I'd like. 😁

    • @seanszarkowicz
      @seanszarkowicz Місяць тому

      @@deborah_kurata - I watch a lot of youtube for programming (mostly Angular and CSS) and i think if you are in the 10-15 min mark that is a pretty good spot

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Great! Thank you!

  • @julienwickramatunga7338
    @julienwickramatunga7338 Місяць тому

    The decision tree at the end is really helpful, thank you!

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Great to hear that it was helpful. Thank you! 😊

  • @AnthonyDev
    @AnthonyDev Місяць тому

    She's back! Great video. Thanks. 😍
    Waiting for SignalStore videos. 😁

    • @deborah_kurata
      @deborah_kurata  Місяць тому +3

      Thank you! 😊
      With so much new in Angular v19, I want to focus on that for a bit. But I do still plan to dive into SignalStore soon. Thanks again!

  • @edofiliedo
    @edofiliedo Місяць тому

    Thank you Deborah for the valuable information.

  • @Nabulio85
    @Nabulio85 Місяць тому

    Love you and your content.
    Great teacher.
    Have a nice day!

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      You brought a smile to my face this morning. Thank you so much! 😃

  • @elioviaggi9701
    @elioviaggi9701 Місяць тому

    Thanks for update Deborath, clear as always!

    • @deborah_kurata
      @deborah_kurata  Місяць тому +1

      Thank you! 😊

    • @elioviaggi9701
      @elioviaggi9701 Місяць тому

      @@deborah_kurata If I use signal in my project I have to install also zone.js as in the past ?

    • @deborah_kurata
      @deborah_kurata  Місяць тому +1

      See my answer to this question on the "Signals in Action" video.

  • @albertkao5964
    @albertkao5964 Місяць тому +1

    Thanks for the great video and stackblitz !!!
    Is the excellent decision tree at the end available as a file?

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Thank you! 😊
      I could potentially create a PDF file with it. Just not sure how to share that. I don't think we can attach files to a video on YT?

  • @vic_shine
    @vic_shine Місяць тому

    many-many thanks ❤

  • @juliojimenez450
    @juliojimenez450 Місяць тому

    Hello Deborah!
    Excellent video as always!
    I wonder if you plan to make a video about ‘TankStack Query’ which is now available for Angular. That would be great!
    Regards!

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Thank you so much for the kind words.
      With the new resource() and rxResource(), is there still the need for TanStack Query with Angular?

  • @wiliamferraciolli5380
    @wiliamferraciolli5380 Місяць тому +1

    thanks for the tutorial, but is it possible to combine multiple signals as the trigger for either linkedSignal or rxResource? Eg if the user selects a value or chages the filter

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Thank you!
      Yes. In my resource/rxResource video here: ua-cam.com/video/_KyCmpMlVTc/v-deo.html
      You can find where I show multiple signals as the trigger around time code 6:45.

  • @Aoi-uv8ee
    @Aoi-uv8ee Місяць тому

    Hey! Great video as always

  • @CedricLange-l4q
    @CedricLange-l4q Місяць тому

    Thank you Deborah!

  • @daveokey3966
    @daveokey3966 Місяць тому

    I've gotten used to every new version of Angular having updated guidance on effect() that boils down to "you probably don't need to use effect()."

  • @divyak9591
    @divyak9591 Місяць тому

    Hello Deborah, whatever knowledge I have of angular I owe it to your teachings thank you for making it so simple and easy to understand, I use signals in my project to pass data to components , I want the effect to run some component code once signal changes is it the right way to use effect?

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Thank you for the kind words.
      What does that component code do when the signal changes? Could it be done with a computed or linkedSignal instead?

    • @divyak9591
      @divyak9591 Місяць тому +1

      @ yeah, updated to v19 to leverage these new signal additions and reduce use of effects or remove them completely.🙏

  • @jeffreybijl7577
    @jeffreybijl7577 Місяць тому

    Hi Deborah, nice content as always!
    Question what about using the effect to patch a Angular-material form field? Is that good practice?

    • @deborah_kurata
      @deborah_kurata  Місяць тому +2

      It may be ... for now ... depending on what you're doing exactly. Signals do support two-way binding, but that may not be enough.
      Forms is one area that is still missing a good signal solution. The Angular team has "signal forms" on their to do list for 2025. 🤞🏼

  • @richarddefortune1329
    @richarddefortune1329 Місяць тому

    Hello Deborah, thank you so much for this remarkable video.
    I use effect() in replacement for NgOnInit(). In fact, when running initial codes with observables, it's okay to subscribe inside NgOnInit, although it runs only once.
    Let's say I want to update a form with data coming from the signal store, if I don't use effect but rather a computed, then I won't know how to execute code that are not displaying data on the template. (Btw, that's what I did before until I started using effects)
    What I'm describing is like the example with the console.log() you showed at the end. In my case, I'm updating formControls. If I don't use effect then I don't know how to react to new data and execute code to update form.
    I tried to be verbose so that I can better explain

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Forms is one area that is still missing a good signal solution. The Angular team has "signal forms" on their to do list for 2025. 🤞🏼
      Hopefully when that drops you won't need to use an effect() to update form controls. But for now that may be the right solution.
      Thanks!

    • @richarddefortune1329
      @richarddefortune1329 Місяць тому +1

      @deborah_kurata thank you so much

  • @f.ribas1
    @f.ribas1 Місяць тому

    So, the approach I've been using thus far is converting the signal I need to react to using toObservable, then subscribing and updating the other signal. Good or bad? 😅

    • @codeSurvivor
      @codeSurvivor Місяць тому +2

      toObservable uses effects under the hood, so it's pretty similar, with one exception: an effect will track all the signals that run inside of it (including those inside functions called in the effect, which may create unexpected results), while when using toObservable you are sure that it will only react to the signal you explicitly used. The Angular documentation recommends not to use effects except for some specific scenarios, you can check it out there.

    • @deborah_kurata
      @deborah_kurata  Місяць тому +1

      If you can use computed() or the new linkedSignal(), that would be the recommended approach. Would either of those work in your case?

    • @f.ribas1
      @f.ribas1 Місяць тому +1

      @@deborah_kurata I still have to update to Angular 19 to try, but I believe linkedSignal() will definitely do it! Thanks for your reply!! You're the best!

  • @osah712
    @osah712 Місяць тому

    What font do you use in your editor?

    • @deborah_kurata
      @deborah_kurata  Місяць тому +1

      Do you mean the Stackblitz theme? I use Darkblitz (Default Darkblitz)
      The Font Family is set to: 'Droid Sans Mono', 'monospace', monospace

  • @TheSysmat
    @TheSysmat Місяць тому

    Load should using value from request

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Oops! Yep! Good catch! I'll change it in the stackblitz!

  • @Richard-z4w
    @Richard-z4w Місяць тому

    You really hate effect, and I don't blame you, so do I!

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      Seems like it, right? Nah, I don't really hate them. I just see them used in places that they should not be used. And now in v19 we have so many other (better!) options.
      And I'm attempting to pass along the guidance from the Angular team. The docs even say: "Effects are rarely needed in most application code, but may be useful in specific circumstances."

  • @haroldpepete
    @haroldpepete Місяць тому

    Your content is not helpfull, it's super helpfull, you never let me down

    • @deborah_kurata
      @deborah_kurata  Місяць тому

      That means a lot! Thank you so much! 😊