import many items using "require" keyword using instead of "import"

Viewed 25

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?

1 Answers

You should try this:

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