swift-beach-91166
06/07/2022, 6:37 AMexport const getServerSideProps= async ()=>{
const gbFeatures= await fetchGrowthbookFeatures();
return {
gbFeatures
}
}
On my _app.tsx
I did something or of sort
const growthbook = useMemo(()=>{
return new Growthbook({
features: pageProps?.gbFeatures?.features,
attributes: ....// we can set them here as well
})
},[pageProps])
useEffect(()=>{
if( pageProps?.gbFeatures) return ; // since SSR handled it
fetch('apiendpoint').then()//// the usual client approach as per doc
},[growthbook, pageProps?.gbFeatures?])
<GrowthbookProvider growthbook={growthbook}>{children}</GrowthbookProvider>
Any thoughts on this? Happy to contribute and raise a PR..fresh-football-47124
swift-beach-91166
06/07/2022, 7:03 AMfresh-football-47124
Open source platform for stress free deployments, measured impact, and smarter decisions.
Powered by