'How to get uri from apollo client object

Context: I'm working with micro front-end, and I want to access the uri of the apollo client. I'm currently passing the whole client object and I don't want to pass also the uri each time. I defined my ApolloClient object like this:

new ApolloClient({
    ...
    link: ApolloLink.from([errorLink, new HttpLink({ uri: process.env.BACKEND_URL })]),
  });

How can I access the uri from the client object ?

const client = useApolloClient();
const uri = client.???


Solution 1:[1]

the uri is a field on the object, so you should be able use the Dot property accessor: object.property to obtain the URI. You can learn more about the HTTP Link constructor in the Apollo Docs

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Vajda