I have a module that is exporting ApolloClient
called object.js
:
import {ApolloClient, InMemoryCache} from "@apollo/client";
const client = new ApolloClient({
uri: "http://127.0.0.1:3000/graphql",
cache: new InMemoryCache()
});
export default client;
And two modules that are importing it, example1.js
:
import client from "./object";
const client2 = client;
And example2.js
:
import client from "./object";
const client3 = client;
Whenever I import a client
, is it a new instance or the same instance used in multiple modules? In other words, is the imported client
instance the same in the example1.js
and example2.js
, or each import creates a new client
object instance?