Complete the code to define a resolver that accesses the parent argument.
const resolvers = { Query: { user: ([1], args, context) => { return getUserById(args.id); } } };The first argument in a resolver is the parent (or root) object, which contains the result of the previous resolver in the chain.
Complete the resolver to access a field from the parent argument.
const resolvers = { User: { fullName: ([1]) => { return `${parent.firstName} ${parent.lastName}`; } } };The parent argument contains the user object, so you can access its fields like parent.firstName.
Fix the error in the resolver by correctly naming the parent argument.
const resolvers = { User: { age: ([1], args) => { return parent.age; } } };The first argument must be named parent to access the previous resolver's result.
Fill both blanks to correctly destructure the parent argument and access args.
const resolvers = { Query: { post: ([1], [2]) => { return getPostById(args.id); } } };The first argument is parent, the second is args which contains query arguments.
Fill all three blanks to define a resolver using parent, args, and context arguments.
const resolvers = { Mutation: { updateUser: ([1], [2], [3]) => { return updateUserInDb(args.id, args.input, context.db); } } };The resolver function receives parent, args, and context in that order.