🚧 This is the Linkree fork of
statsig-react
lib 🚧The main goal of this fork is to provide lazy loading approach for loading statsig-js js bundle
At first, you need to import
StatsigLazyProvider
import { StatsigLazyProvider } from '@linktr.ee/statsig-react/StatsigLazyProvider' <StatsigLazyProvider sdkKey={`client-${STATSIG_CLIENT_SECRET}`} stage={STAGE} user={{ userID: account.uuid, privateAttributes: { email: account.emailAddress } }} >Then you can use all official hooks from the docs in the children components. For example:
import { useExperiment } from '@linktr.ee/statsig-react/useExperiment'; const { loading, config } = useExperiment('footer_cta_button');Additionally, we added the improved useExperiment where you can pass the default value in order to have more strict types
import { useExperimentValue } from '@linktr.ee/statsig-react/useExperimentValue'; const { loading, value } = useExperimentValue( 'footer_cta_button', 'variation', 'control', );About fork architecture, local development and others, please see the Fork Development section
The Statsig React SDK for single user client environments. If you need a SDK for another language or server environment, check out our other SDKs.
Statsig helps you move faster with feature gates (feature flags), and/or dynamic configs. It also allows you to run A/B/n tests to validate your new features and understand their impact on your KPIs. If you're new to Statsig, check out our product and create an account at statsig.com.
Check out our SDK docs to get started.
🚧 This is the Linkree fork of
statsig-react
lib. This development guide contains specifics which are not related to the official statsig react sdk 🚧
(contains only fork changes)
We're planning to add support of yarn link
, but right now you can publish a new alfa
version from your local PC.
At first, you need to compile it and then publish:
npm run prepare
npm run publish-custom-version
Please make sure that you change the version in the package.json to the alfa -for example - 1.34.0-alpha.96
npm test
for unit testingnpm run styleguide
for checking prettier and eslint rulesnpm run styleguide:fix
for fixing prettier and eslint issues