Created
March 1, 2022 21:15
-
-
Save tore-statsig/0bb12b2eb847847af62d547731d2dca9 to your computer and use it in GitHub Desktop.
StatsigManuallyInitializedProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import StatsigContext from './StatsigContext'; | |
import Statsig from './Statsig'; | |
type Props = { | |
children: React.ReactNode | React.ReactNode[]; | |
userVersion: number; | |
}; | |
export default function StatsigManuallyInitializedProvider({ | |
children, | |
userVersion, | |
}: Props): JSX.Element { | |
return ( | |
<StatsigContext.Provider | |
value={{ | |
initialized: true, // or whatever determines this state | |
statsigPromise: null, | |
userVersion, // bump this when the user is updated to force a rerender | |
initStarted: Statsig.initializeCalled(), | |
}} | |
> | |
{children} | |
</StatsigContext.Provider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment