Skip to main content

GraphQL

Graphql is a query language for your API. Basically it gives clients the power to ask for exactly what they need and nothing more unlike REST when you call an API you get too much data that you might not need at all. Graphql describes the data in the shape of a graph meaning that an Object on your data represents a node and any relationship this object is maintaining with any other objects represents an edge. This unlocks the door to query from multiple resources in one query.

Introduction to GraphQL

Graphql consists of two different components, a graphql client and a graphql server. For us as front-end developers, we only care about the graphql client.

React-apollo#

React-apollo is an amazing graphql client. Compared to other larger graphql clients like Relay, Apollo seems to be the favorite for a lot of reasons. The main one is that it abstracts away all the complexities and it exposes an easy to use API. You give Apollo a graphql endpoint, and it allows you to query from and mutate data on that endpoint in a really nice way using React hooks. And behind the scenes it takes care of things like caching, optimistic UI and subscription for real-time data transfer.

read more about Apollo client

Last updated on by bigfanjs