React Apollo Providers with loading, error and data states
npm install --save @specialblend/apollo-blackbox
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>
)
}
MIT © specialblend