3.0.4 • Published 6 years ago
the-condition v3.0.4
the-condition
Conditional renderer for the-components
Installation
$ npm install the-condition --save
Usage
'use strict'
import React from 'react'
import { TheCondition, TheConditionStyle } from 'the-condition'
class ExampleComponent extends React.PureComponent {
render () {
const value = 1
return (
<div>
<TheConditionStyle/>
<TheCondition if={value === 1}>
<div>Will b render if the condition is true</div>
<div>Can be multiple</div>
</TheCondition>
<TheCondition unless={value === 1}>
<div>Will be rendered unless the condition is true</div>
<div>Can be multiple</div>
</TheCondition>
</div>
)
}
}
export default ExampleComponent
Components
TheCondition
Conditional renderer for the-components
Props
Name | Type | Description | Default |
---|---|---|---|
allOf | arrayOf bool | null | |
if | bool | null | |
someOf | arrayOf bool | null | |
unless | bool | null |
TheConditionStyle
Style for TheCondition
Props
Name | Type | Description | Default |
---|---|---|---|
options | object | Style options | {} |
License
This software is released under the MIT License.