1.3.0 • Published 9 years ago

react-feature-gate v1.3.0

Weekly downloads
63
License
MIT
Repository
github
Last release
9 years ago

React Feature Gate

Simple feature gating components for React.

Installation

Add the package to your project:

npm install --save react-feature-gate

Usage

There are two components that form the feature gating. First, you need to set up the provider at the top level of your component hierarchy:

const features = {
  firstFeature: true,
  secondFeature: false
}

<RootComponent>
  <FeatureProvider features={features}>
    <!-- render children here -->
  </FeatureProvider>
</RootComponent>

You can then control which features are availble using the FeatureGate component. For example, if you set up the provider as defined above:

<FeatureGate feature="firstFeature">
  <h1>I will be rendered, because firstFeature is true</h1>
</FeatureGate>

<FeatureGate feature="secondFeature">
  <h1>I will not be rendered, because secondFeature is false</h1>
</FeatureGate>

Example

An example webpage has been included with this project. If you clone the repo, run npm run example and visit http://localhost:8080/example to view it.

1.3.0

9 years ago

1.2.0

9 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.21

10 years ago

1.0.20

10 years ago

1.0.19

10 years ago

1.0.18

10 years ago

1.0.17

10 years ago

1.0.16

10 years ago

1.0.15

10 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago