Bird
0
0

Which argument in a GraphQL resolver function provides access to shared data like authentication info?

easy📝 Conceptual Q2 of 15
GraphQL - Resolvers
Which argument in a GraphQL resolver function provides access to shared data like authentication info?
Aargs
Bcontext
Cparent
Dinfo
Step-by-Step Solution
Solution:
  1. Step 1: Identify the purpose of context

    Context is an object shared by all resolvers during a request, often used to store authentication, database connections, or other shared info.
  2. Step 2: Compare with other arguments

    Args contains query arguments, parent is previous resolver result, and info has query AST details, so they don't hold shared data.
  3. Final Answer:

    context -> Option B
  4. Quick Check:

    context = shared data like auth [OK]
Quick Trick: Context carries shared info like auth, not args or parent [OK]
Common Mistakes:
  • Using args for shared data
  • Confusing info with context
  • Assuming parent holds shared info

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes