Function: useApollo()

typescript
1
useApollo(): Apollo

Defined in: hooks/index.ts:49

Creates and returns a memoized instance of Apollo DID resolver.

Apollo is the DID resolver component of the Identus SDK that handles resolving Decentralized Identifiers (DIDs) to their corresponding DID Documents.

Returns

Apollo

A memoized Apollo instance for DID resolution

Example

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { useApollo } from '@trust0/identus-react/hooks';
function DIDResolver() {
const apollo = useApollo();
const resolveDID = async (didString: string) => {
try {
const didDocument = await apollo.resolveDID(didString);
console.log('Resolved DID Document:', didDocument);
} catch (error) {
console.error('Failed to resolve DID:', error);
}
};
return (
<button onClick={() => resolveDID('did:prism:example')}>
Resolve DID
</button>
);
}