The context on the client side is not related to the context of the resolvers on the server side.
To pass information to the server you might want to use query arguments. This is what the args
argument in your resolver function is for.
Server side
About the context on the server side, taken from Resolver function signature:
- context: This is an object shared by all resolvers in a particular query, and is used to contain per-request state, including authentication information, dataloader instances, and anything else that should be taken into account when resolving the query. If you’re using Apollo Server, read about how to set the context in the setup documentation.
And also here, graphqlOptions.context:
The context is an object that’s accessible in every single resolver as the third argument. This is a great place to pass information that depends on the current request.
Client side
On the client the context is related to Apollo Link and the network layer.
About Apollo Link Context:
Since links are meant to be composed, they need an easy way to
send metadata about the request down the chain of links.
...
The context is not sent to the server, but is used for link to link communication.