colossal-alligator-31194
07/04/2023, 3:17 PM// Load feature definitions from GrowthBook API
fetch(`${BASE_URL[environment]}`) // no key is passed it's added in server
.then((res) => res.json())
.then((json) => {
growthbook.setFeatures(JSON.parse(json.features)); // the response is a json
})
// ------- Response format
features: {
'continue-button-color': {
defaultValue: 'A',
},
},
my problem now is that this growthbook.setFeatures is not working and when I call useFeature I don't receive any feature:
const value = useFeature('continue-button-color');
value => {value: null, on: false, off: true, source: 'unknownFeature', ruleId: ''}
My app is a client-side react app and I initiate it on useEffect. It was working correctly before when I directly get features from hosted GB, but it won't work with this one. Even when I pass some customised data, it doesn't load features.fresh-football-47124
colossal-alligator-31194
07/04/2023, 3:38 PMfresh-football-47124
better-magician-65629
07/04/2023, 6:39 PMready
you can check. <FeaturesReady />
is essentially checking that but also has timeout functionality. note that ready
will be truthy if either experiments or features are provided to the SDK context and does not require both.colossal-alligator-31194
07/05/2023, 11:49 AM