Upgrading react-test-renderer 17 to 18
Breaking17.0.2 → 18.3.1Breaking12Deprecated16New29Changed36Fixed32
BreakingUpgrade verdict
11 breaking changes.
In plain terms
- An experimental tracing API in the scheduler package has been removed.
- React no longer bundles a polyfill for Object.assign.
- An undocumented internal API is gone.
- Putting elements or multiple children inside a title tag now fails instead of rendering markup browsers would not accept.
Must act Top 5 of 26 that need code or config changes
react-test-renderer publishes an official migration guide for version 18. It covers more than the release notes do.
React 18 upgrade guide ↗Drops object-assign.
What you must change
Breaking11
Removes the unstable scheduler/tracing API.
scheduler/tracingRemoves the object-assign polyfill.
object-assignRemoves the unsupported unstable_changedBits API.
unstable_changedBitsDisallows complex children inside title elements to match browser constraints.
titleIntroduces automatic batching of more state updates, with flushSync available to opt out.
flushSyncAdds a development-only Strict Mode check that unmounts and remounts every component on first mount, restoring previous state.
StrictModeMakes useEffect timing consistent by synchronously flushing effect functions when an update is triggered during a discrete input event.
useEffectTreats hydration mismatches from missing or extra text content as errors and reverts to client rendering up to the closest Suspense boundary.
SuspenseKeeps Suspense trees consistent by discarding an incomplete tree when a component suspends before being fully added, then retrying rendering from scratch.
SuspenseLayout effects are now cleaned up when a tree re-suspends and re-created when the boundary content is shown again.
Throws when act is used in production.
actDeprecations to plan for
Deprecated15
Warns for deprecated findDOMNode outside StrictMode.
findDOMNodeWarns for deprecated test-utils methods.
test-utilsWarns for deprecated Legacy Context outside StrictMode.
Warns for deprecated string refs outside StrictMode.
Warns for deprecated defaultProps for function components.
defaultPropsWarns when using act from test-utils.
acttest-utilsWarns for deprecated unmountComponentAtNode.
unmountComponentAtNodeWarns for deprecated renderToStaticNodeStream.
renderToStaticNodeStreamDiscourages the existing renderToString method, which keeps working.
renderToStringDeprecates ReactDOM.render, which now warns and runs the app in React 17 mode.
ReactDOM.renderReactDOM.hydrateDeprecates ReactDOM.unmountComponentAtNode.
ReactDOM.unmountComponentAtNodeDeprecates ReactDOM.renderSubtreeIntoContainer.
ReactDOM.renderSubtreeIntoContainerDeprecates ReactDOMServer.renderToNodeStream.
ReactDOMServer.renderToNodeStreamWarns if renderSubtreeIntoContainer is called.
renderSubtreeIntoContainerDeprecates renderToNodeStream.
renderToNodeStream