Hiya, does anyone know what is the recommended way to use GrowthBook in a class component?
busy-air-96466
08/11/2023, 7:42 AM
I found a way to do it, by creating a “helper” function component which can be included in the class component. Pass it the name of the feature you want to check, and a callback function. Posting here in case it helps someone else - I see this question has been asked before.
This updates if you manually change the feature value in the GrowthBook devtools.
*export const* _IsFeatureOn_ = ({
featureName,
setIsFeatureOn, _// callback function to set value in parent component state_