Apollo client is a powerful frontend GraphQL library that allows an application using GraphQL to query itself, and the connected GraphQL data service. It is a client side state management library that integrates deeply with GraphQL backends.
Under the covers, Apollo client takes your GraphQL query response, and flattens it into a key-value storage system. Take the following example:
// GraphQL Query and Type
type Account {
id: ID!
userName: String!
}
query getAccount() {
account {
id
userName
__typename // not required, but for illustration
}
}
The query above for a value on type Account, would return a response like this:
{
data: {
account: {
id: 1,
userName: 'user',
__typename: 'Account'
}
}
}
#apollo #graphql #apollo-client #javascript #react