Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1.01 KB

File metadata and controls

38 lines (29 loc) · 1.01 KB
title ApolloProvider
description Apollo Client API reference

{/* @import {MDXProvidedComponents} from '../../../shared/MdxProvidedComponents.js' */}

The ApolloProvider component

The ApolloProvider component uses React's Context API to make a configured Apollo Client instance available throughout a React component tree. This component can be imported directly from the @apollo/client/react package.

import { ApolloProvider } from "@apollo/client/react";

Props

Option Type Description
client ApolloClient An ApolloClient instance.

Example

const client = new ApolloClient({
  cache: new InMemoryCache(),
  link: new HttpLink({
    uri: "http://localhost:4000/graphql",
  }),
});

ReactDOM.render(
  <ApolloProvider client={client}>
    <MyRootComponent />
  </ApolloProvider>,
  document.getElementById("root")
);