@xtreamsrl/react-feature-flags-growthbook
v0.3.1
Published
This package exposes an implementation of the feature flag manager that uses [growthbook](https://www.growthbook.io/).
Downloads
234
Readme
@xtreamsrl/react-feature-flags-growthbook
This package exposes an implementation of the feature flag manager that uses growthbook.
Installation
npm install @xtreamsrl/react-feature-flags-growthbook
Usage
Set up the feature flag tool to be used with configureManager
by passing it an instance of the Growthbook
manager and wrap the main app with the GrowthbookProvider
.
// app.tsx
import { configureManager } from '@xtreamsrl/react-feature-flags';
import { GrowthbookProvider, Growthbook } from '@xtreamsrl/react-feature-flags-growthbook';
const growthbook = new Growthbook({ clientKey: 'your client key' });
configureManager({
manager: growthbook
})
export function App() {
return (
<GrowthbookProvider manager={growthbook}>
<MainApp />
</GrowthbookProvider>
);
}
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.