-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Add “real world” example #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b94a30b
to
bed5d38
Compare
bed5d38
to
b94f9a8
Compare
Renaming this to “real world” example. It has:
|
Bonus: it has error handling too. :-) |
nice! :) |
} | ||
|
||
componentWillMount() { | ||
loadData(this.props); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaearon Looking at this example made me think about how to prevent duplicate fetching of data when you have multiple views all interested in the same information (triggering actions in componentWillMount
, like you do here), so I made this: redux-requests. Would love to get your feedback on it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job. 👍
If you'd like, you can also adopt a convention like https://github.com/acdlite/flux-standard-action (see https://github.com/acdlite/redux-promise as an example middleware using it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gaearon! I actually tried to follow FSA (using meta
); once the "sequence" stuff gets figured out maybe I can change the API to support that.
If you get a chance, I'd love your opinion on a better way to "cancel" entire Action Creator sequences via middleware (or something else)
Port of https://github.com/gaearon/flux-react-router-example.