0.1.6 • Published 8 years ago

react-feature-switch v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

React component to handle feature toggles

Install

npm install --save react-feature-switch

Components

FeatureSwitchRoot

used to store in context features list

FeatureSwitch

local component to handle feature

FeatureNext

component that wraps feature that should be shown if current feature is enable

FeatureCurrent

component that wraps feature that should not be shown if current feature is disable

Use

const featureList=[
    {
        featureName: 'myFeature1',
        enable: true
    },
    {
        featureName: 'myFeature2',
        enable: false
    }
];
<FeatureSwitchRoot featureList={featureList}>
    <div>
        <!-- some other elements -->
        <FeatureSwitch featureName='myFeature1'>
            <FeatureNext>
                this is something to render if current feature is enable
            </FeatureNext>
            <FeatureCurrent>
                this is something to render if current feature is disable
            </FeatureCurrent>
        </FeatureSwitch>
        <!-- some other elements -->
    </div>
</FeatureSwitchRoot>);

Test environment

if NODE_ENV is set to test, all children of FeatureSwitchRoot are rendered

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago