# react-invariant

> React component of invariant

Latest version **0.2.1** (published 2019-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-invariant
pnpm add react-invariant
yarn add react-invariant
bun add react-invariant
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2019-04-01 |
| First published | 2019-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 61.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ravi Dhiman |
| Maintainers | ravid7000 |
| Keywords | invariant, react |

## Links

- npm: https://www.npmjs.com/package/react-invariant
- Repository: https://github.com/ravid7000/react-invariant
- Homepage: https://github.com/ravid7000/react-invariant#readme
- Issues: https://github.com/ravid7000/react-invariant/issues
- npm.io page: https://npm.io/package/react-invariant

## 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.2.1 (latest) — 2019-04-01
- 0.2.0 — 2019-03-31
- 0.1.1 — 2019-03-31
- 0.1.0 — 2019-03-31

## README

# react-invariant

React component for invariant

## Installation

```sh
npm i --save react-invariant
```

```sh
yarn add react-invariant
```

## How to use?

```js
import Invariant from 'react-invariant'

<Invariant condition={someTruthyVal} message="This will not show" />
// or
<Invariant condition={someFalseVal} message="This will show message in red text" />
```

## Props:

| Prop      | Description                                                    |
| --------- | :------------------------------------------------------------- |
| condition | Falsey value to show the message                               |
| message   | `React` element or `string` to show when `condition` is falsey |
| className | Pass `string` of className                                     |
| as        | `string` to override default `div` tag. e.g `span`             |

It also supports `HTMLElement` props.

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