careful-machine-67313
07/21/2022, 3:50 PMfresh-football-47124
future-teacher-7046
careful-machine-67313
07/21/2022, 3:51 PMfuture-teacher-7046
careful-machine-67313
07/21/2022, 3:53 PMfuture-teacher-7046
careful-machine-67313
07/21/2022, 3:56 PMfuture-teacher-7046
id
attributecareful-machine-67313
07/21/2022, 3:57 PMfuture-teacher-7046
careful-machine-67313
07/21/2022, 3:59 PMfuture-teacher-7046
growthbook.evalFeature("your-feature-id")
, can you see what's returned? There should be a source
property that tells you why a specific value was assigned to the featurecareful-machine-67313
07/21/2022, 4:03 PMfuture-teacher-7046
unknownFeature
means the id you are using couldn't be found. That's either caused by a typo in your code or if you're not passing features correctly into the SDKcareful-machine-67313
07/21/2022, 4:15 PMfuture-teacher-7046
null
. But when the features load, it will re-render React and it should work fine.careful-machine-67313
07/21/2022, 4:22 PMfuture-teacher-7046
careful-machine-67313
07/21/2022, 4:36 PM.then((parsed) => {
growthbook.setFeatures(parsed.features);
});
let r = await fetch(`<https://cdn.growthbook.io/api/features/${gbkey}>`)
.then((res) => res.json())
growthbook.setFeatures(r.features)
future-teacher-7046
await
in front of the fetch call if you want to evaluate the features immediately.
await fetch(`<https://cdn.growthbook.io/api/features/${gbkey}>`)
.then((res) => res.json())
.then((parsed) => {
growthbook.setFeatures(parsed.features);
})
null
until they fully load. Adding await
before the fetch will fix thatcareful-machine-67313
07/21/2022, 4:51 PMfuture-teacher-7046
null
. After the useEffect hook finishes, it will populate the features and re-render your application with the correct feature valuescareful-machine-67313
07/21/2022, 5:51 PMfuture-teacher-7046
careful-machine-67313
07/21/2022, 6:32 PM