### What is GraphQL?
GraphQL is a query language for APIs and a runtime for executing queries
against your data.
#### Key Concepts:
1. **Queries**: Fetch data.
```graphql
query {
user(id: 1) {
name
email
}
}
2. Mutations: Modify data.
graphql
CopyEdit
mutation {
updateUser(id: 1, name: "Alice") {
id
name
}
}
3. Schema: Defines the structure of the API.
4. Using with React:
o Use Apollo Client for integration.
javascript
CopyEdit
import { useQuery } from "@apollo/client";
const GET_USERS = gql`query { users { id name } }`;
const { loading, data } = useQuery(GET_USERS);
Benefits of GraphQL:
Reduces over-fetching and under-fetching of data.
Single endpoint for all queries and mutations.