<!-- source-hash: d83768f51ae479d40c21322c0218fe86 -->
A React hook that manages NATS WebSocket client connection lifecycle with automatic connection management and status tracking.

## Key Components

- **`useNatsClient`** - Main hook that creates and manages a NATS client instance
- **`UseNatsClientOptions`** - Configuration interface with `autoConnect` option
- **`UseNatsClientResult`** - Return type containing client, status, connection state, and error information

## Usage Example

```typescript
import { useMemo } from 'react'
import { useNatsClient } from './use-nats-client'

function MyComponent() {
  // Memoize options to prevent reconnections on re-render
  const clientOptions = useMemo(() => ({
    url: 'ws://localhost:4222',
    timeout: 5000
  }), [])

  const { client, status, isConnected, lastError } = useNatsClient(
    clientOptions,
    { autoConnect: true }
  )

  if (lastError) {
    return <div>Connection error: {String(lastError)}</div>
  }

  if (!isConnected) {
    return <div>Status: {status}</div>
  }

  return (
    <div>
      Connected! Client ready for messaging.
      <button onClick={() => client?.publish('test', 'hello')}>
        Send Message
      </button>
    </div>
  )
}
```

The hook automatically handles connection establishment, status updates via event listeners, and cleanup on unmount. The `clientOptions` parameter should be memoized to prevent unnecessary reconnections.