New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

gatsby-theme-whatsgood-fork-apollo

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-theme-whatsgood-fork-apollo

Sets up your Gatsby website for use with Apollo

latest
npmnpm
Version
30.0.4
Version published
Maintainers
1
Created
Source

gatsby-theme-whatsgood-fork-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-whatsgood-fork-apollo@2.

npm install gatsby-theme-whatsgood-fork-apollo @apollo/client

Usage

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

// gatsby-config.js
module.exports = {
  plugins: ['gatsby-theme-whatsgood-fork-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:

  • You provide an isomorphic fetch implementation (such as isomorphic-fetch) as an option to HttpLink
  • Your client is the default export in client.js
// src/gatsby-theme-whatsgood-fork-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

Keywords

gatsby

FAQs

Package last updated on 06 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts