> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skyvexsoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hooks Overview

> All React hooks available in the Stratos Plugin SDK.

The Stratos Plugin SDK provides a set of React hooks that give plugin components access to real-time flight data, shell services, and socket communication. All hooks must be called inside a component tree wrapped by the shell's `PluginShellProvider`.

## Categories

### Core

| Hook                                                | Description                                                                 |
| --------------------------------------------------- | --------------------------------------------------------------------------- |
| [`usePluginContext`](/sdk/hooks/use-plugin-context) | Access the full plugin UI context (auth, config, socket, navigation, toast) |

### Flight Data

| Hook                                                    | Description                                                                |
| ------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`useSimData`](/sdk/hooks/use-sim-data)                 | TanStack Query + Socket.io hook for RAF-throttled real-time simulator data |
| [`useFlightPhase`](/sdk/hooks/use-flight-phase)         | Track the current flight phase with optional field selector                |
| [`useFlightEvents`](/sdk/hooks/use-flight-events)       | Access the live flight event log with comment mutations                    |
| [`useLandingAnalysis`](/sdk/hooks/use-landing-analysis) | Landing rate, bounce count, touchdown data, and settled analysis           |

### Flight Management

| Hook                                                    | Description                                                                           |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [`useFlightManager`](/sdk/hooks/use-flight-manager)     | Low-level flight lifecycle control (start, pause, resume, end)                        |
| [`useTrackingSession`](/sdk/hooks/use-tracking-session) | High-level hook for flight tracking state with derived metadata and recovery handling |

### Shell Integration

| Hook                                                                  | Description                                                                   |
| --------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [`useShellAuth`](/sdk/hooks/use-shell-auth)                           | VA auth state (isAuthenticated, token, user: `PluginPilotUser`)               |
| [`useVaApi`](/sdk/hooks/use-va-api)                                   | Singleton axios instance for the bound airline's API with auto-refresh on 401 |
| [`useShellConfig`](/sdk/hooks/use-shell-hooks#useshellconfig)         | Read plugin-namespaced config values synchronously                            |
| [`useShellNavigation`](/sdk/hooks/use-shell-hooks#useshellnavigation) | Navigate within and between plugins and shell routes                          |
| [`useShellToast`](/sdk/hooks/use-shell-hooks#useshelltoast)           | Trigger success, error, warning, and info toast notifications                 |
| [`usePluginLogger`](/sdk/hooks/use-shell-hooks#usepluginlogger)       | Scoped logger that routes to the shell's logging infrastructure               |

### Socket & Real-Time

| Hook                                                           | Description                                               |
| -------------------------------------------------------------- | --------------------------------------------------------- |
| [`useSocket`](/sdk/hooks/use-sim-data#usesocket)               | Core Socket.io connection singleton with connection state |
| [`useSimulatorData`](/sdk/hooks/use-sim-data#usesimulatordata) | Raw event streaming for simulator data and status         |
| [`useProtocolUrl`](/sdk/hooks/use-sim-data#useprotocolurl)     | Deep link events via the `stratos://` protocol handler    |
| [`useNotifications`](/sdk/hooks/use-sim-data#usenotifications) | Shell notification events                                 |
| [`useSystemMetrics`](/sdk/hooks/use-sim-data#usesystemmetrics) | System metrics streaming (CPU, memory, etc.)              |

## Import

All hooks are exported from the SDK root:

```ts theme={null}
import {
  usePluginContext,
  useSimData,
  useFlightPhase,
  useFlightEvents,
  useFlightManager,
  useTrackingSession,
  useLandingAnalysis,
  useShellAuth,
  useVaApi,
  useShellConfig,
  useShellNavigation,
  useShellToast,
  usePluginLogger,
  useSocket,
  useSimulatorData,
  useProtocolUrl,
  useNotifications,
  useSystemMetrics,
} from "@skyvexsoftware/stratos-sdk";
```

## Common Patterns

### Selecting a subset of data

Most data hooks accept a `select` option. The component only re-renders when the selected value changes — not on every simulator tick.

```tsx theme={null}
const { data: altitude } = useSimData({
  select: (s) => s.data?.altitude ?? 0,
});
```

### Combining hooks

Hooks are designed to be composed. `useTrackingSession` is the most ergonomic entry point for tracking-aware plugins; reach for lower-level hooks only when you need finer control.

```tsx theme={null}
function MyPlugin() {
  const { isTracking, phase, currentFlight } = useTrackingSession();
  const { landingRate } = useLandingAnalysis();
  const toast = useShellToast();
  // ...
}
```
