npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@okaygift/react-feature-flags

v1.0.0

Published

A simple and flexible feature flag system for React to enable continuous deployment and testing.

Readme

React Feature Flags A simple and flexible feature flag system for React, designed to enable continuous deployment, A/B testing, and safe feature rollouts.

The Problem When developing new features, you often want to deploy them to production behind a "flag" so you can test them internally or release them to a small subset of users before a full launch. Managing the conditional logic to show or hide these features can clutter your components and become difficult to manage.

The Solution This library provides a clean, context-based system for managing feature flags. It gives you both a component and a hook to conditionally render parts of your UI based on a centralized flag configuration.

Installation npm install @your-username/react-feature-flags

How to Use

  1. Wrap your app in In your main App.tsx, wrap your application with the FeatureFlagProvider and pass it your feature flag configuration. This object can be loaded from a config file, an API, or even localStorage.

// In your main App.tsx import { FeatureFlagProvider } from '@your-username/react-feature-flags';

const featureFlags = { 'new-dashboard-layout': true, // This feature is ON 'beta-user-profile': false, // This feature is OFF };

function App() { return ( {/* The rest of your application */} ); }

  1. Conditionally Render Components Use the component to easily show or hide parts of your UI.

import { Feature } from '@your-username/react-feature-flags'; import { OldDashboard, NewDashboard } from './Dashboards';

function DashboardPage() { return ( <Feature name="new-dashboard-layout" fallback={}> ); }

In this example, users will see the because its flag is true.

  1. Use the Hook for Complex Logic For more complex scenarios where you need to do more than just render a component, use the useFeature hook.

import { useFeature } from '@your-username/react-feature-flags';

function UserProfile() { const { isEnabled } = useFeature('beta-user-profile');

const handleProfileClick = () => { if (isEnabled) { // Logic for the new beta profile } else { // Logic for the old profile } };

return View Profile }

In this example, the click handler will run the old logic because the beta-user-profile flag is false.

API The top-level provider component.

flags: object (required): An object where keys are feature names and values are booleans.

name: string (required): The name of the feature flag to check.

children: React.ReactNode: Rendered if the flag is true.

fallback?: React.ReactNode: Rendered if the flag is false.

useFeature(name) A hook to check if a feature is enabled.

name: string (required): The name of the feature flag to check.

Returns: An object { isEnabled: boolean }.