@@ -646,19 +646,19 @@ The configuration in <i>main.jsx</i> has to be modified like so:
646646
647647``` js
648648import {
649- ApolloClient , InMemoryCache , createHttpLink ,
650- split // highlight-line
649+ ApolloClient , InMemoryCache , HttpLink ,
650+ ApolloLink // highlight-line
651651} from ' @apollo/client'
652652import { ApolloProvider } from ' @apollo/client/react'
653- import { setContext } from ' @apollo/client/link/context'
653+ import { SetContextLink } from ' @apollo/client/link/context'
654654
655655// highlight-start
656656import { getMainDefinition } from ' @apollo/client/utilities'
657657import { GraphQLWsLink } from ' @apollo/client/link/subscriptions'
658658import { createClient } from ' graphql-ws'
659659// highlight-end
660660
661- const authLink = setContext ((_ , { headers }) => {
661+ const authLink = new SetContextLink ((_ , { headers }) => {
662662 const token = localStorage .getItem (' phonenumbers-user-token' )
663663 return {
664664 headers: {
@@ -668,7 +668,7 @@ const authLink = setContext((_, { headers }) => {
668668 }
669669})
670670
671- const httpLink = createHttpLink ({ uri: ' http://localhost:4000' })
671+ const httpLink = new HttpLink ({ uri: ' http://localhost:4000' })
672672
673673// highlight-start
674674const wsLink = new GraphQLWsLink (
@@ -677,7 +677,7 @@ const wsLink = new GraphQLWsLink(
677677// highlight-end
678678
679679// highlight-start
680- const splitLink = split (
680+ const splitLink = ApolloLink . split (
681681 ({ query }) => {
682682 const definition = getMainDefinition (query)
683683 return (
@@ -711,7 +711,7 @@ npm install graphql-ws
711711The new configuration is due to the fact that the application must have an HTTP connection as well as a WebSocket connection to the GraphQL server.
712712
713713``` js
714- const httpLink = createHttpLink ({ uri: ' http://localhost:4000' })
714+ const httpLink = new HttpLink ({ uri: ' http://localhost:4000' })
715715
716716const wsLink = new GraphQLWsLink (
717717 createClient ({
0 commit comments