Bird
0
0

Which of the following best describes how the context argument is passed to resolvers?

easy📝 Conceptual Q2 of 15
GraphQL - Resolvers
Which of the following best describes how the context argument is passed to resolvers?
AIt is only passed to the root resolver
BIt is created separately for each resolver
CIt is created once per request and passed to all resolvers
DIt is passed as a global variable outside resolvers
Step-by-Step Solution
Solution:
  1. Step 1: Understand context lifecycle in GraphQL requests

    The context object is created once per client request and shared among all resolvers handling that request.
  2. Step 2: Contrast with other options

    It is not recreated for each resolver, nor is it global outside resolvers. It is also not limited to root resolvers only.
  3. Final Answer:

    It is created once per request and passed to all resolvers -> Option C
  4. Quick Check:

    Context lifecycle = One per request [OK]
Quick Trick: Context is one object shared per request [OK]
Common Mistakes:
  • Thinking context is recreated per resolver
  • Assuming context is global outside resolvers
  • Believing context is only for root resolvers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes