InterviewBuddy
All interview questions

Why should GraphQL clients use variables?

Beginner

Answer

Variables pass typed input separately from the operation text, making operations reusable and avoiding manual string interpolation.

Explanation

The server still needs authorization and business validation.

Example

query User($id: ID!) { user(id: $id) { name } }