Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between @apollo/client , apollo-client and apollo boost

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';
like image 999
apps Avatar asked Sep 29 '20 12:09

apps


People also ask

What is Apollo boost?

Apollo Boost is a zero-config way to start using Apollo Client. It includes some sensible defaults, such as our recommended InMemoryCache and HttpLink , which come configured for you with our recommended settings.

What is Apollo Client?

Apollo Client is a comprehensive state management library for JavaScript that enables you to manage both local and remote data with GraphQL. Use it to fetch, cache, and modify application data, all while automatically updating your UI.

Can you have multiple Apollo clients?

With apollo-angular it is possible to use multiple Apollo Clients in your application.

Can you use Apollo Client without Apollo server?

You don't need to use Apollo server according to the FAQ though they do recommend it.


2 Answers

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.

like image 91
timman Avatar answered Dec 28 '22 23:12

timman


  • 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

like image 20
slideshowp2 Avatar answered Dec 28 '22 23:12

slideshowp2