Search⌘ K
AI Features

Create a React Application with Apollo

Explore how to create a React application integrated with Apollo Client to fetch and display data from a GraphQL server. Understand client setup, querying data with useQuery, and managing the data flow within components to build effective data-driven interfaces.

Exercise: Create an application

To practice our skills, let’s change the code files below to make our application display a list of books pulled from our GraphQL server.

import {ApolloClient, InMemoryCache } from "@apollo/client";

const client = new ApolloClient({
    uri: "{{EDUCATIVE_LIVE_VM_URL}}:3000",
    cache: new InMemoryCache(),
}); 

export default client;
Make changes to this widget so its application displays a list of books pulled from our GraphQL server

Solution

The application below successfully queries our GraphQL server using Apollo. The output from the application above should ...