Integration with Growthbook is very simple. First refer to the Growthbook docs and install React package:
npm install --save @growthbook/growthbook-react
Initiate Growthbook instance that will establish communication with the Growthbook API that returns your JSON config per environment.
const growthbook = new GrowthBook({
apiHost: import.meta.env.VITE_GROWTHBOOK_API_HOST,
clientKey: import.meta.env.VITE_GROWTHBOOK_CLIENT_KEY,
enableDevMode: import.meta.env.DEV,
subscribeToChanges: true,
})
Simplest way is to use Growthbook hook to dictate feature behavior.
const featureEnabled = useFeatureIsOn("feature_key")