Set Context with Apollo Client

Published: 04 October 2022
on channel: Jamie Barton
4,229
42

Quite often there will be times you'll want to update your Apollo Client based on the behaviour of users in your app, or authentication headers for logged-in users.

In this video we'll explore adding a custom Apollo Link that updates our request headers using the value from a custom context provider.

We want to pass a custom header with our HTTP request whereby the value is saved in context. The user can change the value at any time, so we'll need to fetch the value on the fly. We can do this with creating a "link chain".

Learn more and get the code: https://graphql.wtf


Watch video Set Context with Apollo Client online without registration, duration hours minute second in high quality. This video was added by user Jamie Barton 04 October 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,229 once and liked it 42 people.