/react-condition

React Condition

Primary LanguageJavaScriptMIT LicenseMIT

React Condition

React conditional rendering more friendly way

Install

npm install reactjs-condition
yarn add reactjs-condition

How it works?

import { If } from 'reactjs-condition'

<If condition={true}>
  <div>TRUE</div>
</If>
import { If, Else } from 'reactjs-condition'

<If condition={false}>
  <div>TRUE</div>
<Else />
  <div>FALSE</div>
</If>
import { If, ElseIf, Else } from 'reactjs-condition'

const fruit = 'Apple'

<If condition={fruit === 'Apple'}>
  <div>Apple</div>
<ElseIf condition={fruit === 'Orange'} />
  <div>Orange</div>
<Else />
  <div>Banana</div>
</If>