Hi! We use the
@growthbook/growthbook-react
-package to setup growthbook for our React app. With the introduction of the typesafe sdk we were looking at adding the typing to catch the typos etc.
Creating the types (
AppFeatures
) with
the instructions works well, but when I try to use them when creating the Growthbook-object with the type defined, typescript is complaining with the error
Expected 0 type arguments, but got 1.
Our code looks like this
import { GrowthBook } from '@growthbook/growthbook-react';
export const growthbook = new GrowthBook<AppFeatures>({
apiHost: '<https://cdn.growthbook.io>',
clientKey: ...,
decryptionKey: ...,
enableDevMode: ...,
onFeatureUsage: (featureKey, result) => {
...
},
trackingCallback: (experiment, result) => {
...
},
});
The exported growthbook object is used as
growthbook.loadFeatures()
when the app renders the first time.
Q: do I need to change to use the
@growthbook/growthbook
-package instead or create a custom hook by using the
useGrowthbook
-hook as base?