feature-flags-reactjs
v1.7.0
Published
Library of Feature Flags from Assertiva to ReactJS
Maintainers
Readme
Feature Flags for ReactJS
Consume the Feature Flags API from Assertiva using this library in ReactJS Projects.
How use
1. Install as dependencies in your project
Using npm:
npm install feature-flags-reactjsUsing yarn:
yarn add feature-flags-reactjs2. Declare a provider in your main script (app.js or app.ts)
import FeatureFlagsProvider from 'feature-flags-reactjs/FeatureFlagsProvider';
const App = () => {
return (
<FeatureFlagsProvider
//required prop
url="http://localhost:5000"
//required prop
product="ProductName"
>
<HomePage />
</FeatureFlagsProvider>
)
}
export default App();
3. In your component use FeatureFlags tag and use onAvailable to success or onUnavailable to error:
import FeatureFlags from 'feature-flags-reactjs/FeatureFlags';
const HomePage = () => {
return (
<FeatureFlags
//required prop
flag="FlagName"
//optional prop
canUse={[]}
// required prop
onAvailable={
<h1>
FlagName is on
</h1>
}
//required prop
onUnavailable={
<h1>
FlagName is off
</h1>
}
/>
)
}
export default HomePage();
