Home > Back-end >  import many items using "require" keyword using instead of "import"
import many items using "require" keyword using instead of "import"

Time:09-07

I want to import Apollo Client in to my project like this.

import { ApolloClient, InMemoryCache, ApolloProvider, gql } from '@apollo/client';

But my project setup only allows "require" keyword as follows.

const express = require('express');

How can I import all the items( ApolloClient, InMemoryCache, ApolloProvider, gql )using "require" keyword?

CodePudding user response:

You should try this:

const { ApolloClient, InMemoryCache, ApolloProvider, gql } = require('@apollo/client');
  • Related