apollo client install in gatsby 1

apollo client install in gatsby

$ npm install gatsby-plugin-apollo @apollo/client

# yarn
$ yarn add gatsby-plugin-apollo @apollo/client

# gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-apollo',
      options: {
        uri: 'https://example.com/graphql'
      }
    }
  ]
};

Here is what the above code is Doing:
1. Install the gatsby-plugin-apollo and @apollo/client packages.
2. Add the gatsby-plugin-apollo plugin to your gatsby-config.js file.
3. Configure the plugin with your GraphQL endpoint.

Now you can use Apollo Client in your Gatsby application.

Similar Posts