Hello, We have to use two different endpoints for one app and I need a way to distinguish each apollo client instance on some pages. I’ve looked up and found the name property in client instance can be a good option. but even though I set a name property when I initialize ApolloClient instance, when I get instance using useApolloClient() hooks, the instance doens’t have the name property. I wonder what I’m doing wrong here.
This is some part of my code.
// client.ts
export const testClient = new ApolloClient({
name:"test app",
uri: 'http://localhost:4000/graphql',
cache: new InMemoryCache(),
});
// index.tsx
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<ApolloProvider client={testClient}>
<BrowserRouter>
<App />
</BrowserRouter>
</ApolloProvider>
</React.StrictMode>
);
// Post.tsx
const client = useApolloClient();
console.log(client) // This instance doens't have name property which I set above in client.ts