react-request
react-request copied to clipboard
React Suspense support
React's future fetcher/Suspense API will have ramifications for React Request. It's too early to say anything with certainty right now, but once that gets more fleshed out I should make a plan here.
At the end of the day, the resolution of this issue will likely be an update to the documentation.
Based on the future fetcher preview, my current thoughts are:
- future fetcher does not implement deduping, so a wrapper or alternative solution may still be necessary. Maybe something like React Request could add that
- future fetcher may conflate the two loading states ( #144 ). It the final API does this, then it may make sense for there to be a wrapper for it
- I am pretty sure that the entire future fetcher demo can be polyfilled right now using the existing React API + render props. Once the API is more finalized, I might make a polyfill for it, and that polyfill may supply additional features (like deduping and splitting out loading states)
- A Promise-based API may make more sense in the future than one that tries to map
fetch
's API. This is something I could do now, but I want to wait because future fetcher may implement the features differently/better. I don't want to write something just to rewrite it or throw it out in a few months 🙂
I'm closing this as revisit. We won't know more until React Suspense is closer to being finalized.
Feel free to leave your comments/ideas in this issue, though!
Reopening. Apollo's React Client has a solution that acts as a prop on their Query component. I can use that as motivation on how to implement it here.
Can you provide a link pointing at that?
I won’t have time to do that for you