react-invariant
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

react-invariant

React component for invariant

Installation

npm i --save react-invariant
yarn add react-invariant

How to use?

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.

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i react-invariant

    Weekly Downloads

    0

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    62.8 kB

    Total Files

    12

    Last publish

    Collaborators

    • ravid7000