Hey folks, many thanks in advance if anyone can he...
# experimentation
n
Hey folks, many thanks in advance if anyone can help. I’m getting started with GrowthBook Experiments in React/Next.js, and there is a bit of a lag between when the feature flag is evaluated and when an experiment value is returned. For instance, I have hidden the test elements in the UI until a check for
gb.ready
returns true. I’m using
useFeatureIsOn('my-id')
to lookup the value. But, the control variant will still show briefly before the experiment logic evaluates and gives the proper variant value. I can get around this by waiting for the
gb.trackingCallback
to fire. But, I feel like there should be a better way, is there a better way?
r
Hi Jeremy, we have a few methods to avoid flickering here including a white overlay<.> However for the best performance and flicker-free experience, we recommend using the Edge SDK.
n
Thanks @flaky-noon-11399! I started working with the Edge SDK, but I don't have it implemented yet. I'm not sure if I'd want to always use the Edge SDK because I have some tests that only change a small part of the page. The rest of the page can be served in the initial static render while the component using an experiment can load later. Overall, I was just wondering why GrowthBook returns the a value based on just the feature flag initially, then later it will return the value based on the experiment?
I found the
useExperiment
hook, but it does the same, initially returns
false
until
trackingCallback
fires, then it returns
true
based on the experiment.
Just a follow up here, looks like this is an issue on my side and a late attributes update. Not a GrowthBook issue 😅
r
Hi Jeremy, good morning. super glad to hear all is now resolved and thank you for the update 🚀