DEV Community

Discussion on: If Svelte and RxJS had a baby

Collapse
 
codechips profile image
Ilia Mikhailov

I probably meant that instead of plain observables it's sometimes more convenient to use Rx subjects as you can define them with default values, in this case an empty array, like new BehaviorSubject([]) that also can act as an observable. This way it won't blow up when you subscribe and try to loop over it in Svelte since initial value is an empty array and not null. You can however achieve same thing with RxJS startWith([]) operator and plain observables too if you want.