This is a major release, and while you’d expect breaking changes, well, there aren’t any. And the same goes with any new features. There aren’t any! And this is a first.
v17 comes with a lot of updates under the hood, and you’d best do the update. You’d obtain speed and some other benefits just by updating, and optionally, progressively refactor code to match the new changes.
Here are some changes
Changes to event delegation
With this change in place, it is now quite safe to nest apps built with different versions of React, although this will start from version 17 and above.
Effect Cleanup Timing
This change only affects the
useEffect() hook since
useLayoutEffect() will keep its synchronous execution.
Changes to align with browsers
They have made a couple of changes related to the event system:
onScrollevent no longer bubbles to prevent common confusion.
onBlurevents have switched to using the native
focusoutevents under the hood, which more closely match React’s existing behavior and sometimes provide extra information.
- Capture phase events (e.g.
onClickCapture) now use real browser capture phase listeners.
Removing Private Exports
A migration to a new method has already been completed that does not rely on these private exports.
No Event Pooling
The old design of event pooling has been eliminated entirely.
Consistent Errors for Returning Undefined
In React 16 and earlier, returning
undefined has always been an error:
In React 17, the behavior for
memo components is consistent with regular function and class components. Returning
undefined from them is an error.
For the cases where you want to render nothing intentionally, return
React 17 enables gradual React upgrades.
When you upgrade from React 15 to 16 (or, soon, from React 16 to 17), you would usually upgrade your whole app at once. This works well for many apps. But it can get increasingly challenging if the codebase was written more than a few years ago and isn’t actively maintained. And while it’s possible to use two versions of React on the page, until React 17 this has been fragile and caused problems with events.
See full list of changes