text: import React from 'react';
  import ReactDOM from 'react-dom';
  import App from 'App';
  import {
    ApolloClient,
    ApolloProvider,
    HttpLink,
    InMemoryCache,
  } from '@apollo/client';
  import { setContext } from 'apollo-link-context';
  import localDemoOptions from 'shared/typePolicyOptions';
  
  const authLink = setContext((_, { headers }) => {
    const token = localStorage.getItem('user-token');
    return {
      headers: {
        ...headers,
        authorization: token ? `bearer ${token}` : null,
      },
    };
  });
  
  const httpLink = new HttpLink({
    uri: process.env.REACT_APP_APOLLO_SERVER,
  });
  
  const options = new InMemoryCache({
    typePolicies: {
      Query: process.env.NODE_ENV !== 'production' && localDemoOptions.Query,
      Mutation:
        process.env.NODE_ENV !== 'production' && localDemoOptions.Mutation,
      Deck: {
        cards: {
          merge: false,
        },
      },
    },
  });
  
  const client = new ApolloClient({
    cache: options,
    link: authLink.concat(httpLink),
    fetchOptions: {
      mode: 'no-cors',
    },
  });
  
  ReactDOM.render(
    <ApolloProvider client={client}>
      <App />
    </ApolloProvider>,
    document.getElementById('root')
  );
  