rc-feature-flags
v1.0.1
Published
Ultra-lightweight, type-safe feature flags for React using TypeScript Declaration Merging.
Maintainers
Readme
🚀 Quick Start
1. Install
pnpm add rc-feature-flags2. Define Flags (Type-Safe)
// src/flags.d.ts
import 'rc-feature-flags';
declare module 'rc-feature-flags' {
interface Register {
flags: {
newDashboard: boolean;
betaAccess: boolean;
};
}
}3. Usage
import { FeatureFlagProvider, Feature, useFeature } from 'rc-feature-flags';
const App = () => (
<FeatureFlagProvider initialFlags={{ newDashboard: true }}>
<Feature name="newDashboard">
<NewDashboard />
</Feature>
</FeatureFlagProvider>
);📚 Documentation
Detailed guides are available in the docs folder:
- Getting Started — Full setup guide
- API Reference — Components, hooks, and types
- Advanced Usage — API fetching, persistence, and patterns
- Examples — Integration with React Router, etc.
✨ Features
- Size: ~1KB minzipped. Zero dependencies.
- Type-Safe: Autocomplete for flag names using Module Augmentation.
- Hooks & Components:
useFeature(),<Feature>, and<PrivateRoute>. - Flexible: Works with any state management or API.
📄 License
ISC © Raman Sharma
