This message was deleted.
# announcements
w
This message was deleted.
f
Hi Karen. Your first
then
block isn't returning anything. It would need to look like this:
Copy code
.then((res) => {
  console.log('what is res', res)
  return res.json()
})
👍 1
w
Thank you. Another issue that I am running into- I’m seeing
source: unknownFeature
when I invoke the
useFeature(featureName)
. Upon previous conversation, I know that this error is likely caused by the configuration of the app. My goal is to build a custom hook that implements growthbook to the specific component needed. I’m not wrapping entire app in
<GrowthBookProvider>
. Ideally, I can create a custom hook that calls the
useFeature
hook so that I can return the feature flag value needed in whichever component needed. 1. Is wrapping
<GrowthBookProvider>
around a specific component instead of the entire app a plausible use case? Or do I need to wrap the whole app in the GrowthBook Provider? 2. Does
useFeature()
need to be called in a specific order or instance? --> trying to understand where does the
unknownFeature
error coming from since I could get
growthbook.setFeatures
to work from your previous comment. Thank you for your help.
f
The useFeature hook requires GrowthBookProvider somewhere up the component chain. If you don't want to use that, you could just use our JavaScript SDK instead of the React one. One thing to watch out for is that you probably only want to fetch the features from the API once and store it globally. Otherwise, every components using your custom hook will do a new expensive network request.
👍 1
138 Views