redux-cycles icon indicating copy to clipboard operation
redux-cycles copied to clipboard

Request for a complex real world example

Open jintoppy opened this issue 8 years ago • 2 comments

Hi,

I got really interested in redux-cycles. But, I am new to streams. Is it possible to add a an example project where there will be multiple async actions in a queue?

For eg. upon selecting an item from the list, a popup displayed which shows different kinds of data about the item, in which each data is the result of an async action.

Thanks much.

jintoppy avatar Apr 01 '17 12:04 jintoppy

I have created a sample react application in redux and redux-thunk. In this application, there will be a list of users. When you click on a user, there will be one async action to get user details which contains the countryId of the user. Using that information, next async action is triggered to get all states.

How can we improve this scenario with redux-cycles?

You can see the code here and demo here.

The part in which I am really interested is given below.

let promise = this.props.getUserDetails(this.props.selectedUser.id);    
promise.then(() => {
    this.props.getStates(this.props.selectedUser.country);
});

I am not liking this way of coding, because, now there is a dependency and the order is important in this approach.

How this can be re-written using redux-cycles?

Thanks much.

jintoppy avatar Apr 01 '17 18:04 jintoppy

@jintoppy I've been looking at https://github.com/cyclejs-community/awesome-cyclejs#example-applications. Did you find any complex example apps? I'm looking for one that uses HTTP progress.

aaronmcadam avatar May 09 '17 13:05 aaronmcadam