https://www.growthbook.io/ logo
b

bulky-monkey-20562

05/04/2023, 2:30 PM
Hello, I am getting an issue. When I route from page A to Page B the feature flag is not setting, it is setting false. But when I refresh the page the flag get set. I am using react sdk
Copy code
const showWhatsapp = useFeatureIsOn("show-whatsapp-pdp");
  console.log('show flag', showWhatsapp)
f

fresh-football-47124

05/04/2023, 2:44 PM
You probably need to use a hook to update the flag
we have some examples of this in our example repo
b

bulky-monkey-20562

05/04/2023, 2:49 PM
followed the same as per docs. I am using
useFeatureIsOn
to get the flag
f

fresh-football-47124

05/04/2023, 3:07 PM
do you have something like this?
Copy code
useEffect(() => {
    // Load features from the GrowthBook API and keep them up-to-date
    gb.loadFeatures({ autoRefresh: true });
  }, []);
b

bulky-monkey-20562

05/04/2023, 3:19 PM
yes
I tried
gb.loadFeatures()
this as well
the value in
_trackedFeatures
of the flag is coming ‘null’
2 Views