Home > Blockchain >  Make changes using MAP in http observable inside service or observer
Make changes using MAP in http observable inside service or observer

Time:12-02

I am taking a course from Pluralsight. The course mentions it is a good practice to make changes to the observables using map inside the service. I just want to know wouldn't it be better to make changes outside the service to the observables since the same data maybe shared by other components as well?

I just want to know what is a good practice. Should I use MAP inside the service or the component?

CodePudding user response:

Yes, it's a good practice, to make changes to the observables using "map" pipe, but if multiple components use your data source in different ways, make only generic changes in your service (suitable for all subscribers), and then you can make specific changes in another service serving a specific component.

  • Related