react-fun-with-flags
v0.3.1
Published
OBS! This library is still under development and may change it's api without warning. Use at your own risk.
Readme
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;