Skip to main content

Overview

This section provides a detailed reference for all React hooks available in the Suki Web SDK.

UseSuki Hook

The useSuki hook is a React hook for managing SDK state and operations within React components. The code snippet below shows how to use the useSuki hook to access SDK state and methods:
Typescript
const client: UseSukiReturn = useSuki();

Returns

It returns a UseSukiReturn object containing SDK state and methods for ambient session management.

UseSukiReturn Type

Return type of the useSuki hook containing SDK state and methods.
JavaScript
type UseSukiReturn = {
  activeAmbientId: string | null;
  attemptLogin: () => void;
  cancelAmbient: () => void;
  error: SukiError | null;
  init: (options: ReactInitOptions) => void;
  isAmbientInProgress: boolean;
  isAmbientPaused: boolean;
  isInitialized: boolean;
  on: <T extends keyof EmitterEvents>(
    type: T,
    handler: (args: EmitterEvents[T]) => void | Promise<void>,
  ) => () => void;
  pauseAmbient: () => void;
  resumeAmbient: () => void;
  setEncounter: (encounter: Encounter) => Promise<void>;
  setPartnerToken: (partnerToken: string) => void;
  startAmbient: () => void;
  submitAmbient: () => void;
};

Available Properties

Available Methods

Next Steps

Refer to the Provider Types to learn more about the provider types.