Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-tote

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-tote

A declarative approach to handling your graphql queries in React

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

apollo-tote

👜 A declarative approach to handling Apollo queries in React

npm version

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
    query={`
      query {
        user {
          id
        }
      }
    `}
    test={data => !!(data && data.user && data.user.id)}
    handleFail={() => Store.dispatch({ type: 'LOG_OUT' })}
    handlePass={() => Store.dispatch({ type: 'LOG_IN' })}
    renderError={error => this._renderError(error)}
    renderLoading={() => <App.Loading />}
    render={() => <App />}
/>
  • Render loading component until data comes back.
<ApolloTote
    query={`
      query {
        user {
          imageUrl
        }
      }
    `}
    renderLoading={() => <Avatar.Loading />}
    render={value => <Avatar imageUrl={value.user.imageUrl} />}
/>

PropTypes

  • skip: Boolean - Should we skip over query and just render?
  • query: String - Your graphql query
  • variables: String - Graphql query variables
  • test: Function (Optional) - helper to handle a successful query's response
  • handlePass: Function (Optional) - a function to render a successful test
  • handleFail: Function (Optional) - a function to render a failed test
  • renderError: Function - error function
  • renderLoading: Function - loading function
  • render: Function - a function that renders the result of your query

Keywords

FAQs

Package last updated on 20 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc