1.0.4 • Published 4 years ago

@specialblend/apollo-blackbox v1.0.4

Weekly downloads
28
License
MIT
Repository
github
Last release
4 years ago

@specialblend/apollo-blackbox

React Apollo Providers with loading, error and data states

NPM JavaScript Style Guide

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

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago