https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
i

important-electrician-17322

05/23/2022, 10:58 PM
Hi! excited to get going with growthbook. reading the basic react example, just want to validate my understanding. in the example we're loading the features at runtime, so if some page that uses a feature is rendered before that effect runs (i.e. if we start from that page or statically render it with Next.js) we will end up rendering with whatever fallback we provide? reading the code doesn't seem like
useFeature
is subscribed to updates so it won't re-render after
setFeatures
is eventually called (which might be correct anyway so we don't flicker). wondering how y'all think about this, for static pages like that is the intent that we just bundle the features with our app? and for pages where we do want the feature to load from the growthbook api in the rendering path we just make sure the features are loaded before rendering?
for making sure the features are loaded might be cool to have some wrapper component in the React SDK down the line that loads the features / suspends (when suspense for data fetching is GA)
f

future-teacher-7046

05/23/2022, 11:06 PM
The provider does do a re-render when you call setFeatures
But yes, there will be a flash if you have a static page. I like the idea of a suspense wrapper. Shouldn't be too hard to do either.
i

important-electrician-17322

05/23/2022, 11:14 PM
sweet just wanted to make sure I was understanding correctly thanks!
17 Views