So I am learning reactive programming, and I am building an app for fun that listens on various stock information tickers, and calculates specific things to show in charts etc.
So right now I have information coming from different sources, each of one is one RxJS observable (think stream), so my "ticker$" observable is a
combineLatest of all the different ones.
Then I calculate different things based off the arrays that the
ticker$ observable emits, and ultimately I do a
mergeAll() on the calculations result observable, so from that point on I have a flattened observable with useful information over time.
The my question is about maintaining state, performing side effects, things like that. If I want to continue chaining observables this way, I end up adding to the inputs of the observable things that I calculate and thus produce a new output containing new and old information, sort of Railway Oriented Programming, Since if I just map the values and produce new changed output I end up loosing information and later operators for instance can't log out previous data.
There is also the problem of maintaining state, let's say I use
scan to maintain some state but then that state it's needed in another part of the app, what would be a good way of handling this?.