Skip to content

Mocked React Apollo Providers for loading, error and data states

Notifications You must be signed in to change notification settings

specialblend/apollo-blackbox

Repository files navigation

@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

About

Mocked React Apollo Providers for loading, error and data states

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published