todo-react-redux icon indicating copy to clipboard operation
todo-react-redux copied to clipboard

Example of route data resolution?

Open ninjasort opened this issue 9 years ago • 4 comments
trafficstars

Angular has a concept in it's ui.router you may know, resolve. I'm wondering if you would recommend doing that for react router, loading all data for a route using onEnter or using your componentWillMount..? Do you know the scalability of each?

ninjasort avatar Sep 01 '16 02:09 ninjasort

From what I've read the react-router devs discourage using onEnter to fetch data. From my own experience, it's not a very nice fit within a redux workflow.

I generally dispatch actions from one of the component life-cycle methods, and rely on redux-saga or redux-observable to handle the async life-cycle (pending, fetch, fulfilled, failed).

r-park avatar Sep 04 '16 20:09 r-park

@r-park Thanks for the clarification. It doesn't look like your using react-saga within this example. Would you be open to a PR or adding that in?

ninjasort avatar Sep 05 '16 17:09 ninjasort

@cameronroe the redux-saga version is here

r-park avatar Sep 05 '16 18:09 r-park

Awesome. Any recommended pieces on learning Saga? Seems like a few new concepts here. Thanks!

ninjasort avatar Sep 07 '16 17:09 ninjasort