Skip to content

Upgrading react-test-renderer 15 to 16

Breaking15.7.0 → 16.14.0Breaking35Security1Platform1Deprecated8New72Changed79Fixed151Other2

BreakingUpgrade verdict

35 breaking changes and a platform requirement change and a security fix.

  • The callback parameters of ReactDOM.createRoot() are removed, and using them now triggers warnings.
  • Code using the old concurrent mode API must switch to the new root API.
  • The experimental AsyncMode export has a new name.
  • The experimental Placeholder component and its delayMs prop have new names.
Top 5 of 45 that need code or config changes

Adds prop-types ^15.6.2, react-is ^16.8.6, scheduler ^0.19.1.

Drops fbjs.

Installs 6 packages in all (was 16).

Breaking35
Removes ReactDOM.createRoot() callback params and adds warnings on usage.
ReactDOM.createRoot()
Removes unstable_ConcurrentMode in favor of unstable_createRoot.
unstable_ConcurrentModeunstable_createRoot
Renames unstable_AsyncMode to unstable_ConcurrentMode.
unstable_AsyncModeunstable_ConcurrentMode
Renames unstable_Placeholder to Suspense and delayMs to maxDuration.
unstable_PlaceholderSuspensedelayMsmaxDuration
Renames the Scheduler package to scheduler.
scheduler
Renames the "tracking" API to "tracing".
trackingtracing
Removes unstable_deferredUpdates in favor of unstable_scheduleWork from schedule.
unstable_deferredUpdatesunstable_scheduleWorkschedule
Removes useSyncScheduling from the React Reconciler host config.
useSyncScheduling
Calling setState with null no longer triggers an update.
setState
componentDidUpdate no longer receives the prevContext parameter.
componentDidUpdateprevContext
Shallow renderer no longer calls componentDidUpdate() because DOM refs are not available.
componentDidUpdate()componentDidMount()
Shallow renderer no longer implements unstable_batchedUpdates().
unstable_batchedUpdates()
Errors in render and lifecycle methods now unmount the component tree by default.
Removes the react-with-addons.js build; compatible addons are published separately on npm.
react-with-addons.js
Removes the experimental unstable_createRoot and unstable_createSyncRoot APIs, now available in the Experimental channel as createRoot and createSyncRoot.
unstable_createRootunstable_createSyncRootcreateRootcreateSyncRoot
Effect clean-up functions must return either undefined or a function; all other values, including null, are not allowed.
Scheduler switches from the deadline object to the shouldYield API.
shouldYield
Deletes the experimental React Call Return API due to bundle size impact and API quality.
Replaces React.unstable_AsyncComponent with React.unstable_AsyncMode.
React.unstable_AsyncComponentReact.unstable_AsyncMode
Changes the hydration API for better Flow typing.
ReactDOM.render() and ReactDOM.unstable_renderIntoContainer() now return null when called inside a lifecycle method.
ReactDOM.render()ReactDOM.unstable_renderIntoContainer()
Calling setState directly in render now always causes an update.
setStaterender
The setState callback now fires immediately after componentDidMount or componentDidUpdate instead of after all components rendered.
setStatecomponentDidMountcomponentDidUpdate
When replacing <A /> with <B />, B.componentWillMount now always runs before A.componentWillUnmount.
componentWillMountcomponentWillUnmount
Changing a component's ref now detaches later, when applying DOM changes, instead of before render.
ref
Re-rendering into a container modified by something other than React now emits a warning.
ReactDOM.unmountComponentAtNode
Non-unique keys may now cause children to be duplicated or omitted instead of raising a hard error.
key
ReactDOM.unstable_batchedUpdates now only takes one extra argument after the callback.
ReactDOM.unstable_batchedUpdates
Single-file browser build names and paths changed to distinguish development and production builds.
react/dist/react.jsreact/dist/react.min.jsreact-dom/dist/react-dom.jsreact-dom/dist/react-dom.min.js
Server renderer rewritten: no markup validation, no comments for empty components, no data-reactid attributes.
data-reactid
Hydrating server rendered HTML now requires ReactDOM.hydrate instead of ReactDOM.render.
ReactDOM.hydrateReactDOM.render
Unknown props passed to DOM components now render in the DOM for valid values.
Removes 15.x deprecations from core: React.createClass, React.PropTypes, React.DOM, react-addons-test-utils and shallow renderer move to separate packages.
React.createClassReact.PropTypesReact.DOMreact-addons-test-utilsreact-test-renderer/shallow
Changes internal event names, which can break third-party packages relying on React internals.
Changes the experimental React Reconciler host config shape to be flat without nested objects.
Security1
Fixes a potential XSS vulnerability when an attacker controls an attribute name (CVE-2018-6341).
Platform1
Adds a peer dependency on React 16.3+ for Create Subscription.
Deprecated8
Deprecates React.createFactory().
React.createFactory()
Deprecates unstable_createPortal.
unstable_createPortal
Deprecates old names for the UNSAFE_* lifecycle methods.
UNSAFE_componentWillMountUNSAFE_componentWillReceivePropsUNSAFE_componentWillUpdate
Deprecates javascript: URLs as a common attack surface.
Deprecates uncommon module pattern (factory) components.
Deprecates the Jest-specific ReactTestUtils.mockComponent() helper.
ReactTestUtils.mockComponent()
Deprecate ReactDOM.unstable_createPortal() in favor of ReactDOM.createPortal().
ReactDOM.unstable_createPortal()ReactDOM.createPortal()
Stops publishing new releases on Bower starting with 16.1.0; old releases remain available and Bower configs can point to React UMD builds on unpkg.