Skip to content

Commit 7b7534e

Browse files
authored
Replace setContext with SetContextLink in Apollo setup
From @apollo/client v4 setContext is now SetContextLink.
1 parent d912ae7 commit 7b7534e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/8/en/part8d.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ After the backend changes, creating new persons requires that a valid user token
166166
```js
167167
import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client' // highlight-line
168168
import { ApolloProvider } from '@apollo/client/react'
169-
import { setContext } from '@apollo/client/link/context' // highlight-line
169+
import { SetContextLink } from '@apollo/client/link/context' // highlight-line
170170

171171
// highlight-start
172-
const authLink = setContext((_, { headers }) => {
172+
const authLink = new SetContextLink(({ headers }) => {
173173
const token = localStorage.getItem('phonenumbers-user-token')
174174
return {
175175
headers: {

0 commit comments

Comments
 (0)