# Error

Media error state and actions for the player store

Tracks media errors.

## Import

```tsx
import { errorFeature } from '@videojs/react';
```

The `audioFeatures`, `liveAudioFeatures`, `liveVideoFeatures`, and `videoFeatures` [feature bundles](https://videojs.org/docs/framework/react/guides/presets) include this feature.

## API Reference

### State

| Property | Type | Description |
| --- | --- | --- |
| `error` | `{ code: number; message: string } \| null` | The current media error, or null if none. |

### Actions

| Action | Type | Description |
| --- | --- | --- |
| `dismissError` | `() => void` | Dismiss the current error by clearing it. |

### Selector

Pass `selectError` to [`usePlayer`](https://videojs.org/docs/framework/react/reference/api/use-player) to subscribe to error state. Returns `undefined` if the error feature is not configured.

**ErrorDisplay.tsx**

```tsx
import { selectError, usePlayer } from '@videojs/react';

function ErrorDisplay() {
  const err = usePlayer(selectError);
  if (!err?.error) return null;

  return (
    <div>
      <p>{err.error.message}</p>
      <button onClick={err.dismissError}>Dismiss</button>
    </div>
  );
}
```

---

React documentation: https://videojs.org/docs/framework/react/llms.txt
All documentation: https://videojs.org/llms.txt
