Echo JS 0.11.0

<~>

xat 2559 days ago. link 1 point
Looks nice!

How would I do something like an Ajax request when the component did mount? Am I even supposed to do that using recycle or would I have to fallback to classical react components in order to achieve that?
domagojk 2559 days ago. link 1 point
Sorry, I neglected the fact you need this on "componentDidMount".

I plan to add sources.lifecycle stream where you can listen for that event and then make your request.
xat 2559 days ago. link 1 point
No Problem. sources.lifecycle sounds like a nice idea!

So the "Rx.Observable.interval(1000)" in the example gets called on componentWillMount at the moment, correct?
domagojk 2559 days ago. link 1 point
Yes, that's correct.

update() and dispatch() functions are called only once, on componentWillMount.
domagojk 2559 days ago. link 1 point
Personally, I would use some redux middleware, but if you don't want that, and you need your ajax call to result in component state change, you can use RxJS ajax and switchMap inside update() function.

Similar to featured example with Observable.interval(1000), you would then use Observable.ajax and ajax response would be passed in "reducer" operator where you can change a component state.

If, however, you're using Redux but don't wish any middleware, you can dispatch ajax response the same way - only when ajax is completed, an action would be dispatched.
xat 2559 days ago. link 1 point
Thanks, I somehow overlooked the Observable.interval(1000) example.