Bootstrapping the Apollo Client
At this point, you will have the GraphQL backend up and running. Now, you can focus on your React components in the frontend. In particular, you're going to look at the Apollo Client in a React application. In web apps, it's usually React Router that bootstraps Apollo Client. Let's now look at the src/index.js
file that serves as the entry point for your web app:
import React from 'react'; import ReactDOM from 'react-dom/client'; import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'; import App from './App'; import './index.css'; const client = new ApolloClient({ cache: new InMemoryCache(), uri: 'http://localhost:4000/graphql', }); const root = ReactDOM.createRoot(document.getElementById('root')); root.render( <React.StrictMode> <ApolloProvider client...