Feature request
Is your feature request related to a problem?
Yes. PostHog's React SDK currently provides a useFeatureFlagEnabled hook for checking feature flags, but there is no dedicated hook for change gates. When developers use both feature flags and change gates in the same codebase, it becomes difficult to distinguish between the two concepts at a glance — they both appear to use the same hook, making the code harder to reason about and maintain.
Describe the solution you'd like
Add a useChangeGate hook to the PostHog React SDK that is semantically and functionally distinct from useFeatureFlagEnabled. This hook would allow developers to check change gates explicitly, making it immediately clear in code whether a gate check is for a feature flag or a change gate.
Example usage:
const isChangeEnabled = useChangeGate('my-change-gate');
This mirrors the existing pattern of useFeatureFlagEnabled but clearly communicates the intent of checking a change gate rather than a feature flag.
Describe alternatives you've considered
Using the existing useFeatureFlagEnabled hook for both feature flags and change gates — but this conflates two distinct concepts and makes the code less readable. Adding a naming convention (e.g., prefixing change gate keys with a string) was also considered, but that is fragile and not enforced at the API level. Also in the posthog dashboard it would be nice to filter by those changeGates easily.
Additional context
PostHog already provides useFeatureFlagEnabled for feature flags. Having a parallel useChangeGate hook would bring parity and improve developer experience by making the distinction between feature flags and change gates explicit in code. This would also improve discoverability and documentation, as developers could easily find the right hook for each use case.
Debug info
- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]
Feature request
Is your feature request related to a problem?
Yes. PostHog's React SDK currently provides a
useFeatureFlagEnabledhook for checking feature flags, but there is no dedicated hook for change gates. When developers use both feature flags and change gates in the same codebase, it becomes difficult to distinguish between the two concepts at a glance — they both appear to use the same hook, making the code harder to reason about and maintain.Describe the solution you'd like
Add a
useChangeGatehook to the PostHog React SDK that is semantically and functionally distinct fromuseFeatureFlagEnabled. This hook would allow developers to check change gates explicitly, making it immediately clear in code whether a gate check is for a feature flag or a change gate.Example usage:
This mirrors the existing pattern of
useFeatureFlagEnabledbut clearly communicates the intent of checking a change gate rather than a feature flag.Describe alternatives you've considered
Using the existing
useFeatureFlagEnabledhook for both feature flags and change gates — but this conflates two distinct concepts and makes the code less readable. Adding a naming convention (e.g., prefixing change gate keys with a string) was also considered, but that is fragile and not enforced at the API level. Also in the posthog dashboard it would be nice to filter by those changeGates easily.Additional context
PostHog already provides
useFeatureFlagEnabledfor feature flags. Having a paralleluseChangeGatehook would bring parity and improve developer experience by making the distinction between feature flags and change gates explicit in code. This would also improve discoverability and documentation, as developers could easily find the right hook for each use case.Debug info