DEV Community

Discussion on: Migrate react-apollo from v2 to v3 in conjunction with AWS AppSync

Collapse
 
danielbayerlein profile image
Daniel Bayerlein • Edited

ℹ️ Meanwhile there is a new package from Apollo called @apollo/client.

  1. npm uninstall @apollo/react-common apollo-link apollo-client apollo-cache-inmemory
  2. npm install @apollo/client
  3. Replace the obsolete imports with the new ones:
import React from 'react'
import ReactDOM from 'react-dom'
import { createAuthLink } from 'aws-appsync-auth-link'
import { createSubscriptionHandshakeLink } from 'aws-appsync-subscription-link'
- import { ApolloProvider } from '@apollo/react-common'
- import { ApolloLink } from 'apollo-link'
- import ApolloClient from 'apollo-client'
- import { InMemoryCache } from 'apollo-cache-inmemory'
+ import { ApolloProvider, ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client'
import Auth from '@aws-amplify/auth'
Enter fullscreen mode Exit fullscreen mode