This is a demo React app showcasing the @flagsync/react-sdk for feature flag usage.
- Type-safe flag evaluation
- Event tracking
- Real-time flag updates
- FlagSync CLI included (@flagsync/cli)
- Add your FlagSync SDK key to
.env:VITE_FLAGSYNC_SDK_KEY=your-key-here
To find this, navigate to the desired workspace environment from the Dashboard. Be sure to use a client-side SDK key.
- Install dependencies and start the dev server:
npm install npm run dev
- Update the flag key in
example.use-flag.tsxto the flag you want to test:const { value, isReady } = useFlag(<flagKey>, <defaultValue>);
- Visit http://localhost:5173/ to see the flag value and try out the examples.
- Toggle the flag in the Flags Dashboard and see real-time updates in the app.
Optional, but highly recommended
Run the FlagSync CLI to get full type safety and autocompletion when accessing flags:
npm run generateconst { value, isReady } = useFlag('my-first-kill-switch', false);For more detailed information about the SDK features and usage, visit: