Connect external observables #351
pasha-bolokhov
started this conversation in
Ideas
Replies: 2 comments 6 replies
-
Can you show an example of what you expect using Elf? |
Beta Was this translation helpful? Give feedback.
5 replies
-
Would you be willing to consider if I implemented this? I mean, technically I'd be repeating a lot of what RxAngular guys did, but I do find it an important feature |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I couldn't find a good answer. How to add an external observable to the Store? Obviously, we don't want to track the observable itself (as a reference), because it won't likely change, but we want its data to be joined into our state. RxAngular, for instance, has the
connect()
method. With Elf/Store, I have to manually add "tap()" on that external observable to update the Store — which is not very reactive…Here's an example how it would be useful:
More importantly, if we did have
connect()
method, then subscribing tousername$
in the template, would trigger the http request. That would be easy and reactive throughout the whole store — starting from the template and all the way to triggering the http request.However, currently, in Elf/Store we can just subscribe to
username$
, which subscribes to the store, which triggers nothing… Yes, it will work, because the store will happen to have the value for the username, but it's not reactive / declarativeMy feel is that Elf was more fit for React users, who don't really use observables, and they have their own concept of "reactivity". To be more precise,
setState()
is not reactive, it is imperative. In Angular you're only truly reactive if you're using declarative code all throughouttap()
is not declarativeBeta Was this translation helpful? Give feedback.
All reactions