This example demonstrates both provider patterns in react-featureflow-client.
-
Install dependencies:
yarn install
-
Start the example app:
yarn start
The example supports two provider modes that you can switch between using the buttons in the UI:
- URL:
http://localhost:3000 - Uses
<FeatureflowProvider>component - Client initializes in
useEffect(after mount) - Simple setup, but may cause brief flicker as features load
- URL:
http://localhost:3000/#async - Uses
asyncFeatureflowProvider()function - Client initializes before React renders
- No flicker — features available immediately
- Recommended for production apps
src/index.tsx– Entry point with both provider modes and mode switchingsrc/HooksExample.tsx– Example usage ofuseFeatureflowanduseFeatureshooks
Update your Featureflow SDK Key in src/index.tsx:
const FF_KEY = 'js-env-<your-sdk-key-here>';- This example uses Create React App
- It links to your local version of
react-featureflow-clientfor development
For more details, see the main README.