Once a subgraph is deployed to the Subgraph Studio or to The Graph Explorer, you will be given the endpoint for your GraphQL API that should look something like this:
Using the GraphQL endpoint, you can use various GraphQL Client libraries to query the subgraph and populate your app with the data indexed by the subgraph.
Here are a couple of the more popular GraphQL clients in the ecosystem and how to use them:
Apollo client
Apollo client supports web projects, including frameworks like React and Vue, as well as mobile clients like iOS, Android, and React Native.
Let's look at how to fetch data from a subgraph with Apollo client in a web project.
First, install @apollo/client and graphql:
npm install @apollo/client graphql
Then you can query the API with the following code: