Being inspired by Apollo’s Query component and the way it is abstracting away all internals from presentation, I tried to adapt their solution to make it easier to make REST API calls.
In my example I will fetch for a GitHub user’s repos. Here is how Query component will look like:
And here is this query component usage:
Here is the codesandbox demo:
https://codesandbox.io/s/ko3wjqn4y3
Query component pattern is based on render prop pattern, more details here.
This pattern can also be used in different cases, not just data access.
Phone/Fax: +44 (0) 20 8090 0828
Email: info@atomate.net