Skip to content

Latest commit

 

History

History

README.md

React SDK Demo

This is a demo React app showcasing the @flagsync/react-sdk for feature flag usage.

✨ Features

  • Type-safe flag evaluation
  • Event tracking
  • Real-time flag updates
  • FlagSync CLI included (@flagsync/cli)

🚀 Quick Start

  1. 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.

  2. Install dependencies and start the dev server:
    npm install
    npm run dev
  3. Update the flag key in example.use-flag.tsx to the flag you want to test:
    const { value, isReady } = useFlag(<flagKey>, <defaultValue>);
  4. Visit http://localhost:5173/ to see the flag value and try out the examples.
  5. Toggle the flag in the Flags Dashboard and see real-time updates in the app.

🖥️ FlagSync CLI

Optional, but highly recommended

Run the FlagSync CLI to get full type safety and autocompletion when accessing flags:

npm run generate

🔧 Example Usage

const { value, isReady } = useFlag('my-first-kill-switch', false);

📖 Documentation

For more detailed information about the SDK features and usage, visit: