Releases: optimizely/react-sdk
Releases · optimizely/react-sdk
Release 4.0.0
[4.0.0] - May 18, 2026
v4 is a ground-up rewrite of the React SDK. For a detailed upgrade guide, see MIGRATION.md. For the official documentation, see the React SDK Developer Docs.
New Features
- New hook API —
useDecide,useDecideForKeys,useDecideAllreplace the olduseDecision,useExperiment, anduseFeaturehooks. Return type changed from positional tuples ([decision, clientReady, didTimeout]) to discriminated union objects ({ decision, isLoading, error }). - Async decision hooks —
useDecideAsync,useDecideForKeysAsync,useDecideAllAsyncfor use with CMAB (Contextual Multi-Armed Bandit) experiments and async User Profile Service lookups. useOptimizelyClienthook — Access the OptimizelyClientinstance directly (replaceswithOptimizelyHOC).useOptimizelyUserContexthook — Access the currentOptimizelyUserContext, with{ userContext, isLoading, error }return type. Use for event tracking and forced decisions.- Modular client configuration —
createInstancenow accepts dedicated factory-created components (createPollingProjectConfigManager,createStaticProjectConfigManager,createBatchEventProcessor,createForwardingEventProcessor,createOdpManager,createVuidManager,createErrorNotifier,createLogger) for granular control and smaller bundles. - CMAB support — Contextual Multi-Armed Bandit experiments via async decide hooks (
useDecideAsync). New decide options:IGNORE_CMAB_CACHE,RESET_CMAB_CACHE,INVALIDATE_USER_CMAB_CACHE. - Holdouts support — Holdouts Feature Experimentation capability.
- Feature Rollouts — A new experiment type combining Targeted Delivery simplicity with A/B test measurement capabilities, including full impact analytics and metric tracking.
- Async User Profile Service — Support for asynchronous user profile service lookups.
getSendBeaconEventDispatcherexport — New event dispatcher using the Beacon API for reliable event delivery on page unload.
Breaking Changes
- Underlying JS SDK upgraded from v5 to v6 — See the JavaScript SDK v6 Migration Guide for details.
- ESM only — No CommonJS entry point. Projects using
require()must switch to ESM imports or configure their bundler. - Node.js >=18.0.0 required (was >=14.0.0).
- Provider prop renamed —
optimizely→client. - Provider
userprop no longer accepts aPromise— Resolve the user before rendering. - Removed Provider props —
isServerSide,userId,userAttributes. - Default
timeoutchanged — From5000ms to30000ms. onReady()behavior changed — Resolves on success, rejects on failure (no longer returns{ success, reason }).createInstancethrows on invalid config (previously returnednull).- Event processing, ODP, VUID, and logging are opt-in — Must be explicitly enabled via factory functions.
- Removed components —
OptimizelyExperiment,OptimizelyFeature,OptimizelyVariation. - Removed HOC —
withOptimizely. - Removed hooks —
useDecision(renamed touseDecide),useExperiment,useFeature,useTrackEvent. - Removed per-hook
autoUpdateoption — Hooks now automatically re-evaluate on datafile polling updates. No opt-in needed. - Removed per-hook
overrideUserId/overrideAttributes— Use separate<OptimizelyProvider>instances for different users instead. - Removed exports —
ReactSDKClient,OptimizelyContext,setLogger,setLogLevel,logOnlyEventDispatcher,enums,logging,errorHandler. createLoggerreplacessetLogger/setLogLevel— Logging disabled by default; passcreateLogger({ logLevel })tocreateInstance.getQualifiedSegmentsreturn type changed — Now returns{ segments, error }instead ofstring[] | null.
Changed
- Null/undefined user behavior — Provider now accepts
user={null}in addition toundefined. When no user is provided, hooks return{ isLoading: true }instead of attempting to create a user context.
Release 3.4.0
[3.4.0] - Mar 9, 2026
New Features
- Add a server-safe bundle that is automatically resolved when imported in React Server Components, excluding client-only React APIs (#318)
- Add
qualifiedSegmentsprop toOptimizelyProviderfor passing pre-fetched ODP segments, enabling synchronous ODP-based decisions during SSR (#318) - Add
getQualifiedSegmentsutility for fetching ODP audience segments server-side (#318)
Enhancements
Release 3.3.1
[3.3.1] - Dec 8, 2025
Changed
- Widen React Native peer dependency version ranges.
- Improve notification center type definitions with strongly-typed listener payloads.
Release 3.3.0
[3.3.0] - Oct 13, 2025
New Features
- Added
customHeadersoption todatafileOptionsfor passing custom HTTP headers in datafile requests.
Bug Fixes
- Fix the EventTags type to allow event properties.
- Fix typo in event.experimentIds field in project config.
Release 3.2.4
[3.2.4] - May 15, 2025
Bug fixes
client.onReady()always returns false when ODP is off and user id is null bug fix.(#302)
Release 3.2.3
Release 3.2.2
[3.2.2] - Aug 21, 2024
Bug fixes
- Multiple instances of the Logger make the log system unconfigurable - bug fix. (#276)
Release 3.2.1
[3.2.1] - Aug 15, 2024
Bug fixes
clientReadyis true even though internal client promise returnssuccess == falsebug fix(#273)useDecisionhook set the update listener on overy render bug fix(#273)setForcedDecisiondoes not reflect the changes in optmizely instance anduseDecisionhook bug fix(#274)
Changed
Release 3.2.0
[3.2.0] - July 10, 2024
New Features
- The new
useTrackEventhook is now available for tracking events within functional components. This hook offers all the existing track event functionalities provided by the SDK. (#268)