react-conditionals

v0.0.1
Conditional components for React using JSX
react conditional if else statement switch case jsx component and 1 more...

React Conditionals

Conditional components for React using JSX - Demo

Examples

If else

<If condition={this.state.age >= 18}>
  <Then>
    You can drink in the UK!
  </Then>
  <Else>
    You can't drink in the UK...
  </Else>
</If>

Note: This can also be used without an else component

If without an else

<If condition={this.state.errors}>
  <Then>
    {this.state.errors}
  </Then>
</If>
npm i react-conditionals

Metadata

  • MIT
  • Whatever
  • Jake 'Sid' Smith
  • released 8/25/2015

Downloads

Maintainers