# reakit-warning

> Reakit warning

Latest version **0.6.2** (published 2021-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install reakit-warning
pnpm add reakit-warning
yarn add reakit-warning
bun add reakit-warning
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2021-09-06 |
| First published | 2020-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8625 |
| Author | Diego Haz |
| Maintainers | diegohaz |
| Keywords | reakit, react, warning |

## Links

- npm: https://www.npmjs.com/package/reakit-warning
- Repository: https://github.com/reakit/reakit/tree/master/packages/reakit-warning
- npm.io page: https://npm.io/package/reakit-warning

## Dependencies (1)

- [reakit-utils](https://npm.io/package/reakit-utils.md) ^0.15.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.6.2 (latest) — 2021-09-06
- 0.7.0-alpha.1 (next) — 2021-04-25
- 0.6.1 — 2020-12-11
- 0.6.0 — 2020-11-12
- 0.6.0-alpha.4 — 2020-10-24
- 0.6.0-alpha.3 — 2020-09-22
- 0.5.5 — 2020-09-22
- 0.6.0-alpha.2 — 2020-09-06
- 0.6.0-alpha.1 — 2020-09-05
- 0.6.0-alpha.0 — 2020-09-03
- 0.5.4 — 2020-09-03
- 0.5.3 — 2020-08-24
- 0.5.2 — 2020-08-17
- 0.5.1 — 2020-08-13
- 0.5.0 — 2020-08-06
- … 9 more at https://npm.io/package/reakit-warning/versions

## README

# reakit-warning

<a href="https://npmjs.org/package/reakit-warning"><img alt="NPM version" src="https://img.shields.io/npm/v/reakit-warning.svg?style=flat-square" /></a>

> **This is experimental** and may have breaking changes in minor versions.

## Installation

npm:

```sh
npm i reakit-warning
```

Yarn:

```sh
yarn add reakit-warning
```

## Reducing bundle size

Literal strings aren't minified. Keeping them in your production bundle may increase the bundle size significantly.

To prevent that, you should:

1.  Put `reakit-warning/babel-plugin` into your [babel config](https://babeljs.io/docs/en/plugins#plugin-options).

    This will make sure your `warning` and `useWarning` calls are wrapped within a condition that checks if `process.env.NODE_ENV !== 'production'`.

2.  Use [UglifyJS](https://github.com/mishoo/UglifyJS2), [Terser](https://github.com/terser/terser) or any other JavaScript parser that performs [dead code elimination](https://en.wikipedia.org/wiki/Dead_code_elimination). This is usually used in conjunction with JavaScript bundlers, such as [webpack](https://github.com/webpack/webpack).

    When parsing the code in `production` mode, the `warning` call will be removed altogether.

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [useWarning](#usewarning)
-   [warning](#warning)

### useWarning

Logs `messages` to the console using `console.warn` based on a `condition`.
This should be used inside components.

#### Parameters

-   `condition` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
-   `messages` **...[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** 

### warning

Logs `messages` to the console using `console.warn` based on a `condition`.

#### Parameters

-   `condition` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
-   `messages` **...[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** 

#### Examples

```javascript
import { warning } from "reakit-warning";

warning(true, "a", "b"); // console.warn("a", "\n", "b")
warning(false, "a", "b"); // does nothing
```

## License

MIT © [Diego Haz](https://github.com/diegohaz)

---
_Source: https://npm.io/package/reakit-warning · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
