GraphQL
GraphQL is only a specification
Concepts
- Schema
- Collection of GraphQL types
- Contract between client and server
- Mutations (Create, update, delete data) (link)
- Subscriptions (Real time updates)
- Resolver functions (??)
Clients
2 major GraphQL clients
Comparison:
Relay Modern:
- Very opinionated structure and naming convention (src)
- Takes a little more development time (src)
- Works well with React Native (src)
Apollo:
Why GraphQL client?
No need to worry about low-level networking tasks (fetch functions), all you need to do with GraphQL is write a query where you declare your data requirements.
GraphQL + React
GraphQL clients use the concept of higher-order components to fetch the needed data under the hood and make it available in the props
of your components.