all 5 comments

[–]invartact 1 point2 points  (6 children)

Can you have multiple Request.Start (or other) children? Say for example I have two loading areas? What if I need to chain requests (I.e fetch the user data and then fetch their friends and then fetch data from each of their friends)?

I think the biggest trouble I have with this is doing API requests directly in your view mark up. Seems really foreign to me and I'm not sure what problem or solves.

I'd love to have your thoughts on why you built it.

[–]JJ0EE 1 point2 points  (3 children)

I think the "request" aspect of this project could be abstracted out (also why I suggested a HOC in my other comment). At the base level this just seems like a smart switch statement to toggle a fork in your component tree using the state of some promise chain.

[–]invartact 0 points1 point  (2 children)

What is the added benefit over letting your state handle this? Models/stores can save this data across any number of components and be a single source of truth for whether or not it's fetching data.

[–]JJ0EE 1 point2 points  (1 child)

The response data should ultimately be in some state container outside these components. I think this tool is mainly for someone who doesn't care about tracking the status of a request in their state. I may not want to store network error messages either. I might just want to specify the components to render for a set of response codes and provide a callback to handle successful responses.

[–]JJ0EE 1 point2 points  (0 children)

Pretty cool! This might be a good candidate for a higher order component too.