Relay (GraphQL)
https://relay.dev/docs/guided-tour/rendering/fragments/
How does Relay know which endpoint to talk to?
The useLazyLoadQuery
 hook fetches and returns the data. It takes two arguments:
- The GraphQL query that we defined before.
- Variables that are passed to the server with the query. This query doesn’t declare any variables, so it’s an empty object.
Fragments
The main building block for declaring data dependencies for React Components in Relay are GraphQL Fragments.
Fragments are one of the distinguishing features of Relay. They let each component declare its own data needs independently, while retaining the efficiency of a single query.
Ahh, fragments is sort of where the efficiency comes from, the compiler combines these fragment queries into a single query.
Fragments are a selection of fields on a GraphQL type:
fragment UserFragment on User {
name
age
profile_picture(scale: 2) {
uri
}
}
In order to render the data for a fragment, you can use the useFragment Hook: