ImFusion Web SDK

useImFusionState

ts
function useImFusionState(): ImFusionState;

Returns the SDK initialization state.

Both imf and error are nullable. Use this when you need to handle loading, ready, and error states in a single component.

Returns

ImFusionState

The current ImFusionState

Throws

If called outside of an ImFusionProvider

Example

tsx
function StatusBar() {
  const { imf, error } = useImFusionState();

  if (error) return <p>Error: {error.message}</p>;
  if (!imf) return <p>Loading...</p>;
  return <p>Ready</p>;
}

See