Graphql fragment example

broken image

If you’ve wondered why in the previous chapters you had to do the edges - node -dance everytime you needed to access information about the items in a list that was returned by the server - this is the answer to it. Note: The article Understanding pagination: REST, GraphQL, and Relay on the Apollo blog has a great overview on different pagination models.

broken image

This meta information can be used by clients to implement more sophisticated pagination approaches than a simple limit-offset pagination (also referred to as numbered pages ). The goal of this concept is to enrich a simple list of items with meta information about the list itself. Relay ConnectionsĪs mentioned briefly in the 3rd chapter, lists in Relay are implemented using the concept of connections.

broken image

In this chapter, you’ll get to know a new API that’s called PaginationContainer and that provides a nice abstraction for implementing pagination in a Relay app.

broken image

You already know about Relay’s FragmentContainer API that allows you to wrap a React component along with a GraphQL fragment that represents the component’s data dependencies and then lets Relay figure out how and when to fetch the needed data.

broken image