apollo-tote
👜 A declarative approach to handling Apollo queries in React
Installation
yarn add apollo-tote
or
npm install --save apollo-tote
Usage Examples
- Fetch
current user
query. If an api token exists but is no longer valid (ie: cleared database), log user out.
<ApolloTote = = = = = = =/>
- Render loading component until data comes back.
<ApolloTote = = =/>
PropTypes
skip
: Boolean - Should we skip over query and just render?query
: String - Your graphql queryvariables
: String - Graphql query variablestest
: Function (Optional) - helper to handle a successful query's responsehandlePass
: Function (Optional) - a function to render a successfultest
handleFail
: Function (Optional) - a function to render a failedtest
renderError
: Function - error functionrenderLoading
: Function - loading functionrender
: Function - a function that renders the result of your query