1.3.0 • Published 7 years ago

react-feature-gate v1.3.0

Weekly downloads
63
License
MIT
Repository
github
Last release
7 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

7 years ago

1.2.0

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.21

8 years ago

1.0.20

8 years ago

1.0.19

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago