-
Notifications
You must be signed in to change notification settings - Fork 46
Injecting new state asynchronously #97
Comments
@crobinson42 AFAIK you can call effects at any point and they will modify the state as expected, so you should be able to subscribe to your Firebase events in your component's |
Thanks! I see that's the solution for using freactal inside the component
context. I'm looking for a solution to affect state from outside a react
component context.
…On Feb 16, 2018 3:09 PM, "Aleksey Gurtovoy" ***@***.***> wrote:
@crobinson42 <https://github.com/crobinson42> AFAIK you can call effects
at any point and they will modify the state as expected, so you should be
able to subscribe to your Firebase events in your component's initialize
and call effects.updateFromServer() (or however your call yours) with the
new data.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFsmS8ATCHpSmZWhccJ0WEJr2x10qu7zks5tVgqxgaJpZM4R_I9f>
.
|
the initialize event has access to the event registry; you could externalize the events into any context you want and call them whenever. (and/or do AJAX stuff there). I'm assuming that you're happy with the react system on which state has been imposed still being where you SEE the effects. |
@bingomanatee Thx, I'll check that out.
Not sure what you're assumption is related to or based on... care to share the relevance to problem? |
its easy to export the triggers (effects) but the expression of the result (state) will still be scoped to wherever you bind the state machine. so as long as you're cool with that you should be fine. |
Going to close this as resolved. Aside from what has already been mentioned, you could kick off an effect on The benefit with this approach is the ability to subscribe to Firebase changes only when the component is mounted, which is often the behavior you'll want anyway. Hope that helps. Please re-open if you have any further issues with this. |
I have a case where Firebase events are emitted asynchronously and new data needs to be injected into the state at any time.
With the exception of being jenky and using
wrapComponentWithState()
to inject new state, nothing jumps out right away.In Redux parlance, you can do this in your app when it mounts to invoke "actions" at anytime to effect the state:
How would one go about this use case? Thanks! Awesome project, btw!
The text was updated successfully, but these errors were encountered: