difference between @apollo/client , apollo-client and apollo boost
Asked Answered
F

2

9

I am implementing using @apollo/client, but i do not see any complete example of @apollo/client with react. If i search i get example with apollo-client and apollo boost.

What is the difference between all 3. I understand @apollo/client is the new version of all. Where can i get complete example of @apollo/client with react application?

import { ApolloClient, InMemoryCache, ApolloLink, createHttpLink, defaultDataIdFromObject } from '@apollo/client';
import { ApolloClient, InMemoryCache, ApolloLink } from 'apollo-boost';
Finnougric answered 29/9, 2020 at 12:13 Comment(0)
C
6
  • apollo-boost

Apollo Boost includes some packages that we think are essential to developing with Apollo Client. Here's what's in the box:

  • apollo-client: Where all the magic happens
  • apollo-cache-inmemory: Our recommended cache
  • apollo-link-http: An Apollo Link for remote data fetching
  • apollo-link-error: An Apollo Link for error handling
  • graphql-tag: Exports the gql function for your queries & mutations

The awesome thing about Apollo Boost is that you don't have to set any of this up yourself! Just specify a few options if you'd like to use these features and we'll take care of the rest. For a full list of available options, please refer to the Apollo Boost configuration options documentation.

see What's in Apollo Boost

  • apollo-client

The old version(below 3.x) apollo client

  • @apollo/client

The latest version(3.x+) apollo client published as Scoped packages

Check the official get started example

Contagious answered 30/9, 2020 at 5:4 Comment(1)
i am getting this error. React Hook "useQuery" is called in function "getData" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks. I am using same package.json file from the example link. I ran the exmaple link you gave, it works fine. I created the app using yarn create-reactapp. is that something causing this issue?Finnougric
C
14

Just to add to the already posted answer for anyone wondering if they should still be using Boost.

From the docs:

The Apollo Boost project is now retired, because Apollo Client 3.0 provides a similarly straightforward setup. We recommend removing all apollo-boost dependencies and modifying your ApolloClient constructor as needed.

Caffey answered 16/4, 2021 at 17:2 Comment(0)
C
6
  • apollo-boost

Apollo Boost includes some packages that we think are essential to developing with Apollo Client. Here's what's in the box:

  • apollo-client: Where all the magic happens
  • apollo-cache-inmemory: Our recommended cache
  • apollo-link-http: An Apollo Link for remote data fetching
  • apollo-link-error: An Apollo Link for error handling
  • graphql-tag: Exports the gql function for your queries & mutations

The awesome thing about Apollo Boost is that you don't have to set any of this up yourself! Just specify a few options if you'd like to use these features and we'll take care of the rest. For a full list of available options, please refer to the Apollo Boost configuration options documentation.

see What's in Apollo Boost

  • apollo-client

The old version(below 3.x) apollo client

  • @apollo/client

The latest version(3.x+) apollo client published as Scoped packages

Check the official get started example

Contagious answered 30/9, 2020 at 5:4 Comment(1)
i am getting this error. React Hook "useQuery" is called in function "getData" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks. I am using same package.json file from the example link. I ran the exmaple link you gave, it works fine. I created the app using yarn create-reactapp. is that something causing this issue?Finnougric

© 2022 - 2024 — McMap. All rights reserved.