feature-flags-react

Integrate PostHog feature flags into React applications using @posthog/react hooks.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/FrekiManagarm/dunlo --skill feature-flags-react-frekimanagarm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: feature-flags-react
Source: https://github.com/FrekiManagarm/dunlo/tree/main/.agents/skills/feature-flags-react
Command: npx skills add https://github.com/FrekiManagarm/dunlo --skill feature-flags-react-frekimanagarm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps you add PostHog feature flag checks to React so you can control feature exposure without redeploying or risking inconsistent user experiences.

Core Features & Use Cases

  • React feature flag enablement & payload access: Use React hooks to read boolean or variant-based flags and optionally retrieve payloads.
  • Minimized UI flicker with safer evaluation: Prefer server-side evaluation guidance to reduce delayed flag availability on first load.
  • Maintainable rollout behavior: Follow best practices like using environment variables, minimizing code churn, and handling analytics captures in the right places.

Quick Start

Implement PostHog feature flags in your React app by installing and initializing the SDK, wrapping your app with PostHogProvider, then using useFeatureFlagEnabled or useFeatureFlagPayload to gate React UI behavior based on a flag key.

Frequently Asked Questions about feature-flags-react

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate PostHog feature flags into a React application?

To integrate PostHog feature flags in React, install the SDK, wrap your app with PostHogProvider, and use hooks like useFeatureFlagEnabled to gate UI behavior based on flag keys.

How do I prevent UI flicker when evaluating React feature flags on initial load?

To prevent UI flicker during initial feature flag loading, prefer server-side evaluation and apply safe handling rules for delayed flag availability to ensure consistent rendering before flags resolve.

Can I retrieve custom payloads with PostHog feature flags in React?

Yes, you can retrieve custom payloads in React by using the useFeatureFlagPayload hook to access variant-specific data and render conditional UI behavior based on the returned payload content.

Do I need environment variables to configure PostHog feature flags in React?

Yes, configuring PostHog feature flags in React requires using environment variables for secure SDK initialization, which maintains best practices for rollout management and minimizes code churn.

What is the best way to manage controlled rollouts for React UI components?

Controlled rollouts for React UI components are best managed by evaluating boolean flags and multivariate variants via PostHog hooks, allowing you to control feature exposure without redeploying your application.

Why should I use PostHog for conditional rendering instead of basic environment variables?

Using PostHog for conditional rendering enables dynamic rollout management and multivariate variant checks without redeploying, whereas basic environment variables require code changes and lack analytics correctness.