Hey guys, How are you doing? I have a question ab...
# ask-questions
w
Hey guys, How are you doing? I have a question about the server-side instance of the SDK on NextJS. I saw the example, and it's already working (Server and Client side). (I am not using the flags adapter because I was having an error when I was setting the env variable, it was always forcing me to have the default name of the env vars even if I was passing in the init. It was always saying that it was missing the: GROWTHBOOK_CLIENT_KEY). 1. If I need to check if a feature flag is one, I should always init the Growthbook class, check the feature flag, and then destroy? Can I have one instance as a singleton and import it? Is it a good practice or should I always initiate a new instance?
f
Hi Matheus
instantiation should be very quick, and you can check states for all flags if needed. One instance should be enough. You can just update the atttributes as needed
w
So I can make a singleton that stays a live the whole time. Don't need to instantiate and destroy every time I need, right?
f
yes, correct
1
w
Thanks @fresh-football-47124