react-rendering-conditional
v1.0.0
Published
Conditionally rendered react components
Downloads
2
Maintainers
Readme
React Rendering Conditional
Installation
yarn add react-rendering-conditional
or
npm install react-rendering-conditional --save
Usage
import {Conditional, If, Else} from 'react-rendering-conditional';
<Condition>
<If is={this.state.authenticated}>
If condition
</If>
<Else>
Else Condition
</Else>
</Condition>
It also support for ElseIf block.
import {Conditional, If, Else, ElseIf} from 'react-rendering-conditional';
<Condition>
<If is={false}>
If condition
<Condition>
<If is={false}>
Nested If condition
</If>
<Else>
Nested Else Condition
</Else>
</Condition>
</If>
<ElseIf is={false}>
Else If condition
</ElseIf>
<Else>
Else Condition
</Else>
</Condition>