Skip to content

Documentation / @agentick/react / useConnectionState

Function: useConnectionState() ​

useConnectionState(): ConnectionState

Defined in: react/src/hooks/use-connection.ts:28

Subscribe to connection state changes.

Returns ​

ConnectionState

Example ​

tsx
import { useConnectionState } from '@agentick/react';

function ConnectionIndicator() {
  const state = useConnectionState();

  return (
    <div className={`indicator ${state}`}>
      {state === 'connected' ? 'Online' : 'Offline'}
    </div>
  );
}

Released under the ISC License.