This package exposes an implementation of the feature flag manager that uses launchdarkly.
npm install @xtreamsrl/react-feature-flags-launchdarkly
Set up the feature flag tool to be used with configureManager
by passing it an instance of the LaunchDarkly
manager and wrap the main app with the LaunchdarklyProvider
.
// app.tsx
import { configureManager } from '@xtreamsrl/react-feature-flags';
import { LaunchdarklyProvider, LaunchDarkly } from '@xtreamsrl/react-feature-flags-launchdarkly';
const launchdarkly = new LaunchDarkly('your client id');
configureManager({
manager: launchdarkly
})
export function App() {
return (
<LaunchdarklyProvider manager={launchdarkly}>
<MainApp />
</LaunchdarklyProvider>
);
}
To retrieve the flag value use the useFlag
hook exported from react-feature-flags
.
For more details on how to manage flags read the react-feature-flags README.
A proudly 🇮🇹 software development and data science startup.We consider ourselves a family of talented and passionate people building their own products and powerful solutions for our clients. Get to know us more on xtreamers.io or follow us on LinkedIn.