8 GraphQL concepts every dev should know
(and most can't explain all 8):
👇
1️⃣ Queries
↳ Used to read or fetch data. They represent the way clients can request specific data from a GraphQL server.
2️⃣ Mutations
↳ Used to change data. Similar to queries in syntax, but instead of just fetching data, mutations modify server-side data.
3️⃣ Subscriptions
↳ Used to receive real-time updates. They maintain a persistent connection to the server, allowing clients to be notified automatically when specific data changes.
4️⃣ Types
↳ The building blocks of every GraphQL API. They define the shape of the data through scalars, objects, enums, interfaces, and unions, giving the API its strongly-typed structure.
5️⃣ Fields
↳ The individual units of data on a type. Every query, mutation, and object is composed of fields, and each one returns either a scalar value or another type.
6️⃣ Schema Definition Language (SDL)
↳ The syntax used to write a GraphQL schema. It's human-readable and used to define types, queries, mutations, and the relationships between types.
7️⃣ GraphQL Schema
↳ The contract between the client and the server. It defines the capabilities of the API by specifying how the client can fetch and mutate data.
8️⃣ Resolvers
↳ Server-side functions that handle the fetching or manipulation of data for a particular field of a type in the schema. Each field on each type has a resolver function.
—
Master these 8 and the rest of GraphQL clicks into place — directives, fragments, dataloaders, federation, all of it.
Which one tripped you up the most when you were learning?