Prompt
I’m building a React app and need a simple way to turn features on and off per user, what do you recommend?
Latest observation
Nov 17, 2026
OpenAI APIWeb search: off
For a React app, the simplest and most flexible approach is usually feature flags backed by a small config service or database.
What I recommend
Use a feature-flag system where each feature has:
- a name/key like
newDashboard - a default state (
on/off) - optional rules per user, role, org, or percentage rollout
Why this is a good fit
- Easy to turn features on/off without redeploying
- Target specific users for testing or gradual rollouts
- Safe releases: hide unfinished features behind flags
- Works well in React with a custom hook or context
Simple implementation options
1) Build a lightweight in-app flag system
If you only need a few flags, you can store them in:
- your backend database
- user profile/permissions
- a JSON config endpoint
Then in React, fetch flags on login and expose them via:
FeatureFlagContextuseFeatureFlag('newDashboard')
Example:
const FeatureFlagContext = React.createContext({});
export function FeatureFlagProvider({ flags, children }) {
return (
<FeatureFlagContext.Provider value={flags}>
{children}
</FeatureFlagContext.Provider>
);
}
export function useFeatureFlag(key) {
const flags = React.useContext(FeatureFlagContext);
return !!flags[key];
}
Usage:
const showNewDashboard = useFeatureFlag('newDashboard');
return showNewDashboard ? <NewDashboard /> : <OldDashboard />;
2) Use a managed feature-flag service
If you want targeting, analytics, remote updates, and less maintenance, consider:
- LaunchDarkly
- Split
- Flagsmith
- Unleash
These are great if you need:
- per-user targeting
- gradual rollouts
- experiments/A-B testing
- audit logs and analytics
My practical recommendation
- Small app / early stage: roll your own simple flag system
- Growing product / multiple teams / production rollouts: use a managed feature-flag service
One important tip
Don’t rely on frontend flags alone for security.
If a feature protects sensitive data or actions, enforce access checks on the backend too.
If you want, I can show you:
- a minimal React feature-flag setup, or
- how to integrate a tool like LaunchDarkly or Flagsmith.