This package has been deprecated

    Author message:

    Package no longer supported. Use gatsby-plugin-apollo instead.

    gatsby-theme-apollo

    4.0.0 • Public • Published

    gatsby-theme-apollo

    A Gatsby theme that sets up your website for use with Apollo Client.

    Installation

    This theme is meant to be used with the @apollo/client package. If you aren't already using it, make sure you install it along with this theme.

    Important: @apollo/client is currently in beta. If you want to use this theme with apollo-boost or apollo-client, you can install gatsby-theme-apollo@2.

    npm install gatsby-theme-apollo @apollo/client

    Usage

    Add gatsby-theme-apollo as a plugin in your Gatsby config.

    // gatsby-config.js
    module.exports = {
      plugins: ['gatsby-theme-apollo']
    };

    Required: Shadow this theme's client.js file with your own ApolloClient instance. Check out the Apollo docs to learn more about creating a client.

    However you decide to create your client, you should make sure that:

    1. You provide an isomorphic fetch implementation (such as isomorphic-fetch) as an option to HttpLink
    2. Your client is the default export in client.js
    // src/gatsby-theme-apollo/client.js
    import fetch from 'isomorphic-fetch';
    import {ApolloClient, HttpLink, InMemoryCache} from '@apollo/client';
    
    const client = new ApolloClient({
      cache: new InMemoryCache(),
      link: new HttpLink({
        uri: 'https://api.spacex.land/graphql/',
        fetch
      })
    });
    
    export default client;

    License

    MIT

    Install

    npm i gatsby-theme-apollo

    DownloadsWeekly Downloads

    1,378

    Version

    4.0.0

    License

    MIT

    Unpacked Size

    3.75 kB

    Total Files

    7

    Last publish

    Collaborators

    • apollo-bot
    • jgarrow
    • sbarlow
    • trevorblades