# useDevWarning

## Usage

Fires a dev-only "Component: message" console warning once per mount while the condition holds. It is the safe way for a component to flag misuse: the same check written straight into a `computed` getter or a `watch` callback repeats on every change, and gating it with state adds a re-render, so this watches the condition instead and warns once. For a warning outside a component, use the imperative `devWarn` utility.

```ts
import { useDevWarning } from '@astryx-vue/core'
```

`devWarn` comes from the same entry: `import { devWarn } from '@astryx-vue/core'`. It writes the same `Component: message` line without needing a component instance, and it is stripped from production builds the same way.

## Best practices

| Guidance | Practices |
| --- | --- |
| Do | Say what is wrong and what the builder should do instead; the message is the whole value of the warning. |
| Do | Warn about combinations the types cannot express, such as two mutually exclusive props being set together. |
| Don't | Use it for anything a user could see or for runtime error handling; it is stripped from production builds. |

## Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `component` | `string` | — | Component or hook name, used as the message prefix. Required. |
| `message` | `string` | — | What went wrong and how to fix it. Required. |
| `condition` | `MaybeRefOrGetter<boolean>` | `true` | Whether to warn. A plain boolean, a `ref`, or a getter all work. The first time it is true during a mount the warning fires once, and toggling it again in the same mount stays quiet. |

## Returns

| Name | Type | Description |
| --- | --- | --- |
| — | `void` | Nothing is returned. The watcher stops when the component or effect scope is disposed, and in a production build the function does nothing at all. |
