I could use a hand if anyone is available. I have ...
# ask-questions
w
I could use a hand if anyone is available. I have a feature setup in the Cloud version that I have implemented in my Nextjs React app, but the feature always comes back as
null
. Any idea what I'm doing wrong. It appears to be fully published
f
Hi Ryan, where are you checking the state of the feature?
w
I'm just logging it out
Thanks for the quick reply btw, much appreciated
f
oh, okay - it's probably a race condition, as the fetch hasn't completed. If you're just testing, add it inside the second then()
or after the setAttributes
any success?
w
Same response
f
After setAttributes can you try putting
Copy code
console.log(growthbook.evalFeature("test_feature"))
w
Any clue as to what I am doing wrong here?
f
Nothing wrong. The first time your component renders it will return null for the feature. Then after the fetch completes it should re-render your application and it will get the real feature value.
w
I see, thank you for the feedback and help. Have a great weekend!
b
Hi @white-leather-66229 I have similar problem. I just want to log my feature but it is always null. How did you do it at the end?
w
Mine ended up being a race condition in which the feature query when initializing GB was not resolving before my check against the feature or the above
console.log
b
Okay, thanks for the reply.