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

rapid-exabyte-3349

07/31/2023, 8:35 AM
Hello. how growthbook know which current environment (dev or prod) is using? we are using react native and we want to enable feature only in development. do i need to create a sdk connections that have development environment?
w

white-fireman-22476

07/31/2023, 8:48 AM
Yes, you need to specify the environment when you create the sdk key. You can then choose which envs a feature shows up on with a toggle on the feature page, or the feature overview page. https://docs.growthbook.io/app/features#environments
r

rapid-exabyte-3349

07/31/2023, 9:12 AM
hi @white-fireman-22476 already did that. but when i call the useFeatureIsOn() it is always false even i enabled it
Screenshot 2023-07-31 at 5.13.00 PM.png
w

white-fireman-22476

07/31/2023, 9:16 AM
Do you have the Growthbook Devtools chrome extension? That can help debug what is going on: https://chrome.google.com/webstore/detail/growthbook-devtools/opemhndcehfgipokneipaafbglcecjia
r

rapid-exabyte-3349

07/31/2023, 9:17 AM
i am using react native. does it work?
w

white-fireman-22476

07/31/2023, 9:17 AM
ah
In that case, what are your override rules?
r

rapid-exabyte-3349

07/31/2023, 9:18 AM
i dont have any override rules
Screenshot 2023-07-31 at 5.21.08 PM.png
w

white-fireman-22476

07/31/2023, 9:21 AM
You have a default value of off
so I would expect it would be off for everyone
r

rapid-exabyte-3349

07/31/2023, 9:24 AM
i see. but if i enabled it it will always be true?
w

white-fireman-22476

07/31/2023, 9:24 AM
correct
in general you probably want to leave it as false but provide override rules for who you want to see the feature
r

rapid-exabyte-3349

07/31/2023, 9:25 AM
i see. so to change its value i need to change the default value not the enabled environments toggle?
w

white-fireman-22476

07/31/2023, 9:25 AM
Well the env toggle needs to be on to serve the rule to that environment.
👍 1
Then the feature will always return the default value unless overwritten by the overwrite rules
r

rapid-exabyte-3349

07/31/2023, 9:36 AM
my usecase is to enable the feature in an environment. e.g (enable in dev, disabled in prod)
w

white-fireman-22476

07/31/2023, 9:40 AM
Well one way could be to set the default to true, but disable the prod env var. The other way is to keep default to false, then create an override rule in dev with a 100% rollout percentage.
r

rapid-exabyte-3349

07/31/2023, 9:45 AM
alright. got it. thank you so much, @white-fireman-22476
w

white-fireman-22476

07/31/2023, 9:46 AM
Sure thing. I hope Growthbook works well for you and feel free to give us any feedback or ask any other questions here.
🫡 1
2 Views