npm / @posthog/react
@posthog/react
What changed in @posthog/react 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-21.
1 breaking2 deprecations8 new APIs and options2 behavior and defaults1 tooling10 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@posthog/react 124 changes
Breaking changes 1
Use the posthog.init option evaluationContexts to specify evaluation contexts such as web, mobile, or checkout.
Deprecations 2
The posthog.init option evaluationEnvironments is deprecated in favor of evaluationContexts; it continues to work and logs a deprecation warning.
The package is deprecated.
New APIs and options 8
React error-boundary fallbacks receive a resetError callback so applications can retry rendering without remounting the boundary.
Accepts an optional defaultValue argument, returned while flags are loading or the flag is absent; supplying it narrows the return type to boolean.
Adds the useFeatureFlagResult hook.
displaySurvey gains an option to disable shown tracking.
Popover surveys support question prefill.
Adds the useThumbSurvey hook.
Feature flags can now be bootstrapped during server-side rendering in ReactJS.
Adds a component that wraps components and captures an event when they are in view in the browser.
Behavior and default changes 2
React component stacks are rendered as linked exception causes so error tracking identifies the crashing component.
useThumbSurvey now tracks when a survey is shown.
Tooling 1
CLI and sourcemap utilities moved to @posthog/plugin-utils to remove cross-spawn from React Native dependencies.
Fixes and other changes 10
Without match, PostHogFeature shows the fallback when the flag evaluates to false.
useThumbSurvey now uses the client passed to PostHogProvider instead of capturing no survey events.
The error boundary still reports the original error when a browser extension makes Error.prototype.name non-writable.
Clarifies that false is a conclusive off evaluation and undefined means no evaluation is available; remote evaluation omits globally inactive flags, while backend local evaluation can resolve cached inactive definitions to false.
Type declarations use ReactElement<any, any> instead of importing JSX, allowing typechecking with @types/react back to the declared 16.8.0 floor.
Disabled bootstrap feature flags are filtered from useActiveFeatureFlags.
PostHogProvider no longer throws or initializes when no API key or client is provided.
Local flag evaluation cache preserves $set_once semantics.
Fixes PostHogFeature to properly handle undefined flags and false values.
Feature flag hooks now check whether the client is initialized, preventing client is undefined errors.