0.3.1 • Published 6 years ago
react-fun-with-flags v0.3.1
React Fun With flags
OBS! This library is still under development and may change it's api without warning. Use at your own risk.
Installation
npm install react-fun-with-flagsor
npm install react-fun-with-flagsUsage
Add the FlagProvider to your App.
import React from 'react';
import { FlagProvider } from 'react-fun-with-flags';
const flags = {
fun: true,
with: true,
trains: false
}
<FlagProvider flags={flags}>
{...}
</FlagProvider>Then toggle your components with the help of the Flag, FlagEnabled, FlagDisabled components.
Example:
import React from 'react';
import { FlagEnabled } from 'react-fun-with-flags';
const MyComponent = ({}) => (
<div>
<span>Hello</span>
<FlagEnabled name="fun">
<span>World</span>
</FlagEnabled>
</div>
);
export default MyComponent;