react-pretty-condition
v1.0.7
Published
Flexible condition for use with React
Downloads
19
Maintainers
Readme
react-pretty-condition
Install
npm i --save react-pretty-condition
IF Condition Props
| Props | Type | Required | default | Description | | ------------- |:-------------:| -----:| -----:| -----:| | condition | Boolean | yes | - | Ex: 1 === 1 ? true : false |
Switch Condition Props
| Props | Type | Required | default | Description | | ------------- |:-------------:| -----:| -----:| -----:| | value | Any | yes | - | Ex: 'A' |
Case Condition Props
| Props | Type | Required | default | Description | | ------------- |:-------------:| -----:| -----:| -----:| | value | Any | yes | - | 'A' |
Import for using
import {
If,
Switch,
Case
} from 'react-pretty-condition';
Condition
<If condition={ 1 === 1 ? true : false }>
<div>Test If Condition</div>
</If>
<Switch value="A">
<Case value="A">
<div>Test Switch Condition</div>
</Case>
<Case value="B">
<div>Test Switch Condition</div>
</Case>
</Switch>