react-if-elseif-else-render

This package is for reactjs to use 'if elseif else' in `render` function

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-if-elseif-else-render
1.0.25 years ago5 years agoMinified + gzip package size for react-if-elseif-else-render in KB

Readme

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>
    );
  }
}