Skip to content

Upgrading react 16 to 17

Breaking16.14.0 → 17.0.2Breaking11Deprecated1New8Changed23Fixed25Other2

BreakingUpgrade verdict

11 breaking changes.

  • Synthetic event objects are no longer reused, so they stay valid after the handler returns.
  • Removes unstable_discreteUpdates and unstable_flushDiscreteUpdates.
  • Removes the timeoutMs argument.
  • React now listens for events on each app root rather than on the whole page document.
Top 4 of 12 that need code or config changes

Drops prop-types.

Installs 3 packages in all (was 5).

Breaking11
Removes event pooling.
Removes unstable_discreteUpdates and unstable_flushDiscreteUpdates.
unstable_discreteUpdatesunstable_flushDiscreteUpdates
Removes the timeoutMs argument.
timeoutMs
Delegates events to roots instead of document.
Cleans up all effects before running any next effects.
Runs useEffect cleanup functions asynchronously.
useEffect
Stops emulating bubbling of the onScroll event.
onScroll
Throws if a forwardRef or memo component returns undefined.
forwardRefmemo
Stops exposing internals that won't be needed by React Native Web.
Disables <div hidden /> prerendering in favor of a different future API.
Adds the unstable_ prefix before the experimental APIs.
Deprecated1
Deprecates the undocumented and misleading ReactTestUtils.SimulateNative API.
ReactTestUtils.SimulateNative