1.0.2 • Published 7 years ago
react-if-elseif-else-render v1.0.2
React If Elseif Else Render
This package is for reactjs to use 'if elseif else' in render
function
Installation
npm
npm install react-if-elseif-else-render
yarn
yarn add react-if-elseif-else-render
Example
import { If, Then, ElseIf, Else } from 'react-if-elseif-else-render';
class Example extends Component {
render() {
var i = 3; // it will render '<p>Else</p>'
return (
<If condition={i == 1}>
<Then>
<p>Then: 1</p>
</Then>
<ElseIf condition={i == 2}>
<p>ElseIf: 2</p>
</ElseIf>
<Else>
<p>Else</p>
</Else>
</If>
);
}
}