@specialblend/apollo-blackbox
v1.0.4
Published
React Apollo Providers with loading, error and data states
Downloads
3
Readme
@specialblend/apollo-blackbox
React Apollo Providers with loading, error and data states
Install
npm install --save @specialblend/apollo-blackbox
Usage
import React from 'react'
import MyComponent from './MyComponent'
import typeDefs from './typeDefs'
import { ApolloBlackbox } from '@specialblend/apollo-blackbox'
// simulates query is loading forever
function LoadingExample () {
return (
<ApolloBlackbox loading>
<MyComponent />
</ApolloBlackbox>
)
}
// simulates query returned an error
function ErrorExample () {
const error = new Error('oops. something bad happened.')
return (
<ApolloBlackbox error={error}>
<MyComponent />
</ApolloBlackbox>
)
}
// simulates mock API from typeDefs
function DataExample () {
return (
<ApolloBlackbox typeDefs={typeDefs}>
<MyComponent />
</ApolloBlackbox>
)
}
License
MIT © specialblend