ifElse
Provides conditional x-if/x-else-if/x-else directives. It works the same way as in Vue.js.
Installation
npm install react-beyond @react-beyond/ifelse
Usage
import { Beyond } from 'react-beyond'
import { classFor } from '@react-beyond/ifelse'
<Beyond features={[ifElse()]}>
<Element1 x-if={<condition>} />
<Element2 x-else-if={<condition>} />
<Element3 x-else />
</Beyond>
Options
id- The id of the feature HOC. Defaults to"ifElse".
Directives
-
'x-if'?: boolean- If true, the element will be rendered, otherwise a<></>will be in its place. -
'x-else-if'?: boolean- It can be used as an else if case for a precedingx-iforx-else-if. If there's no precedingx-iforx-else-if, an error will be thrown. -
'x-else'?: true- It can be used as an else case for a precedingx-iforx-else-if. If there's no precedingx-iforx-else-if, an error will be thrown.