Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rc-if-else

qinyuanbin181MIT1.2.1

conditional rendering for react components

react, react-if-else, if-else, conditional-rendering, show-hide-components

readme

rc-if-else

React conditional rendering

NPM version build status Test coverage gemnasium deps npm download

install

rc-if-else

Usage

import { If, Elif, Else } from 'rc-if-else';
...

render(){
  ...
    // if `condition` is `true`, show `Title`, else show nothing.
    <If condition={condition} >
        <h1>Title</h1>
    </If>

    // if `condition` is `true`, show `Title1`, else show `Title2`.
    <If condition={condition} >
        <h1>Title1</h1>
        <Else><h1>Title2</h1></Else>
    </If>

    // if `condition1` is `true`, show `Title1`
    // else if `condition2` is `true`, show `Title2`
    // if all condition failed. show `Title3`
    <If condition={condition1} >
        <h1>Title1</h1>
        <ElIf condition={condition2}><h1>Title2</h1></ElIf>
        <Else><h1>Title3</h1></Else>
    </If>
}

License

rc-if-else is released under the MIT license.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.2.1 (2021-03-23)

1.2.1-0 (2021-03-23)

1.2.0 (2021-03-23)

1.2.0-0 (2021-03-23)

Features

1.1.1-0 (2021-03-23)

1.1.0 (2019-03-25)

1.1.0-2 (2019-03-25)

1.1.0-1 (2019-03-25)

1.1.0-0 (2019-03-25)

Bug Fixes

  • bug: error with react portal child (bb3966f)

Features

  • configs: add project configs (fc969ff)

1.0.1 (2019-02-27)

1.0.1-4 (2019-02-27)

1.0.1-3 (2019-02-27)

1.0.1-2 (2019-02-27)

1.0.1-1 (2019-02-27)

Bug Fixes

1.0.1-0 (2019-02-27)