1.1.1 • Published 8 years ago

react-if-else v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

React If/Else

build status npm version

Render blocks of components using a conditional, and supply to display other blocks. Also supports using conditions to display blocks (you may consider using React-Cond instead for this case).

Usage

Install this package to your project.

Use CommonJS:

var If = require('react-if-else').If;
var ElseIf = require('react-if-else').ElseIf;
var Else = require('react-if-else').Else;

var YourComponent = React.createClass({
  render: function () {
    <div>
      <If cond={true} className="my-conditions">
        If true~~~
        <h2>彼女さん募集中</h2>
      <ElseIf cond={false} className="my-conditions-else-if"/>
        ElseIf true~~~
        <h4>逢いたくなったらまぶたを閉じる</h4>
      <Else className="my-conditions-else"/>
        If false~~~
        <h3>出会いの数だけで別れは増える</h3>
      </If>
    </div>
  }
});

Demo

JSFiddle: http://jsfiddle.net/tkpx7L6a/