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';
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.
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.
With apollo-angular it is possible to use multiple Apollo Clients in your application.
You don't need to use Apollo server according to the FAQ though they do recommend it.
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.
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 happensapollo-cache-inmemory
: Our recommended cacheapollo-link-http
: An Apollo Link for remote data fetchingapollo-link-error
: An Apollo Link for error handlinggraphql-tag
: Exports the gql function for your queries & mutationsThe 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
The old version(below 3.x) apollo client
The latest version(3.x+) apollo client published as Scoped packages
Check the official get started example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With