DEV Community

Discussion on: Simple state management in Angular with only Services and RxJS

Collapse
 
pavelnm profile image
pavelNM • Edited

why use behavior subject with sharereplay?
get todos() is also overkill. It's not a good way to get data from observer, except in async pipe. For adding todo we should use scan operator, same as for mark as completed. Subject with shareReplay (or ReplaySubject) solves all the problems and BehaviorSubject is really redundant here.

Collapse
 
avatsaev profile image
Aslan Vatsaev

Thanks for the feedback, updated.