RxJS Best Practices Aren't Always Black and White

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

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

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

    Thank you Deborah.
    Your explanations are Crystal clear.
    From now I will go declarative

  • @nick.h7566
    @nick.h7566 ปีที่แล้ว +3

    Hands down, whenever I need RxJs information Deborah is ALWAYS the person I come to. Clearest explanations 100% of the time!

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

      Wow, thank you! That's great to hear! 🙏🏼

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

    You have solved some issues for me that I had been trying to figure out for a long time. Thank you so much.

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

      Great to hear! Glad it was useful!

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

    Many thanks and love you ma'am. Your teaching style is very unique and one can learn programming very easily without any tension.

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

      That is great to hear. Thank you!

  • @danieljazz1
    @danieljazz1 9 หลายเดือนก่อน +1

    You're an amazing teacher, Deborah. Thanks a lot! Thinking reactive is not so trivial haha. Your content is helping me so much :)

    • @deborah_kurata
      @deborah_kurata  9 หลายเดือนก่อน +1

      Wow! Thank you so much for the kind words! 😊

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

    Best RxJS videos ever!

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

    Thank you again Deboarah, you are one of my references in my new Angular/RxJS life, learning more and more with you, always. Cheers from Portugal

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

      Thank you!
      We'd love to come to visit Portugal! Do you have any suggestions for places to go? Local meetups we could attend while we are there?

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

      @@deborah_kurata Portugal is very small so in 3 days you can get the best of the North (OPorto, Aveiro (my city), Lisbon (capital) and even the south beaches (Algarve) :) all by train (Alfa Pendular).
      I'm a little out of the path of local meetups in last years.

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

      @@MarcoPinheiro Thanks for the info!

    • @nick.h7566
      @nick.h7566 ปีที่แล้ว

      Salema in Algarve is definitely a place worth visiting! Stunning! But then again, the whole of Portugal is

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

    Thank you ma'am ! Great tutorial ! this is just awesome, you are awesome Deborah ! ManytThanks for putting such effort and love on yours videos

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

      Glad it was helpful! Thank you so much!

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

    I've been working with rxjs for a long time and thoroughly enjoy watching your videos on the topic! You definitely want to subscribe to Deborah! (pun intended)

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

      Just ignore it when the video says to unsubscribe! LOL! Thank you for posting!

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

    Thank you Deboarah Kurata!

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

    Thanks for the great tutorial Deborah! One question how to have a loading: true/false indicator during Ajax call? when to set loading true & false while using async pipe?

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

      Excellent question! I've already got content queued up for the next few days, but I'll put together a video of this later this week.
      Short answer, you can define the flag as a BehaviorSubject and emit when the value needs to change. Then react to that change notification.

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

    Hello Deborah, thank you for sharing the tips. However, I still would have a question about being declarative. You've shown how to declare only the read operation, but what about the mutations (create, update, delete)?
    I mean, in your example, the Users service, you have only onSelected(user) public method returning void, which does make sense. How would you define create/update/delete methods to complete CRUD? I'm a little bit afraid that in this case I still would need to return Observable, right? If we take as an example the Create user (after creating a user, set him/her as a selected user), would have you something like this?
    public create(user: UserModel): Observable {
    return this._http.create(user).pipe(
    do(resp => this.onSelected(resp.id)), // load created user
    map(() => undefined), // throw away the server response to match the observable type
    cacheError(this.handleError),
    );
    }
    Let's not consider caching at this moment, to keep it simple.

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

      Great question! I'm on vacation until Wednesday and will get back to you then.
      In the meantime, I have an example here: github.com/DeborahK/Angular-RxJS

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

      Did the example I provided help?
      From the APM-WithExtras in the product-edit.service.ts:
      ```TypeScript
      // Save the product via http
      // And then create and buffer a new array of products with scan.
      productsWithCRUD$ = merge(
      this.productsWithCategory$,
      this.productModifiedAction$
      .pipe(
      concatMap(operation => this.saveProduct(operation))
      ))
      .pipe(
      scan((acc, value) =>
      (value instanceof Array) ? [...value] : this.modifyProducts(acc, value), [] as Product[]),
      shareReplay(1)
      );
      ```
      I'm currently finishing my JavaScript course here on YT. As soon as that is finished I'll add more content on using a reactive approach to CRUD.

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

    Value of ur rxjs vids is marginal. Thanx alot

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

      What could make them better?

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

      @@deborah_kurata if i may suggest and if ur time permits angular videos illustrated in what could be described as bare metal explanation or in other words how thar complex concept is compiled in browser

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

    Hi Deborah, is there a github repository to try out your teachings?

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

      My github is here: github.com/deborahk

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

    When programming declaritively with RxJS, I often feel like I'm doing something wrong... for example, in a component, if I'm doing something like this:
    myObs$ = this.myService.getMyObs();
    Obviously I can bind myObs$ to the template with the async pipe, but what if I also need that data in some logic in my component (like in some method/function). So with that code, I'd add a pipe, and tap, and in the tap assign the data to a local variable which I can then use in the template function.
    That pattern seems like way more work than just doing the same thing in a subscribe. So my question is.... am I doing this right? Or is there a much better way that I'm missing?

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

      It depends on what you are doing ... but you may be able to accomplish the same thing using the myObs$ observable.
      For example, this code finds the selectedProduct in the products$ observable without needing to use a separate variable to store the data:
      selectedProduct$ = combineLatest([
      this.products$,
      this.productSelectedAction$
      ]).pipe(
      map(([products, selectedProductId]) =>
      products.find(product => product.id === selectedProductId)
      )
      );
      But how we work with RxJS may change a bit soon with the new Angular v16 signals. We may want to get the emitted values and put them into a signal we can work with instead.