Financial TimesAmericas' Fastest-Growing 2025
Certified PartnerOdoo Gold · Adobe Gold Solution · Shopify Premier partnershipsOdoo Gold · Adobe Gold · Shopify Premier partnerSee all
One business dayA senior architect replies to every inquiry · +1 (631) 897-7276Architect reply within one business dayLet's talkCall us
Inc. Regionals 2025Fastest-growing private companies in AmericaInc. Regionals 2025 honoreeSee awards
Americas' Fastest-Growing Companies 2025Recognized by the Financial TimesFT Fastest-Growing Companies 2025See the rankingRanking
4.8 / 5 on Clutch265 verified client reviews4.8/5 on Clutch · 265 reviewsRead the reviews
4.8 · 265 Clutch reviews
US United States
April 23, 202110 min readUpdated on October 17, 2026

React 17 breaking changes and the code each one actually breaks

· Vice President, Mobility Solutions
React 17 breaking changes and the code each one actually breaks

A change handler reads e.target.value inside a state updater. On React 16 it throws. On React 17 the same code just works. The reason is the best-known of the React 17 breaking changes: React removed synthetic event pooling in version 17.0, released on October 20, 2020.

Pooling is the change people search for, but it rarely breaks anything during an upgrade. The changes that do break code are quieter: where React attaches its event listeners, and when effect cleanup runs. This guide covers each React 17 breaking change, the code it touches and the fix, checked against the React team's own release posts.

React 17 breaking changes at a glance

React 17 is an odd major release. The React team's React v17.0 release post says it adds no new developer-facing features. Its job was to make later upgrades gradual, so a large app could move to a future version one part at a time. The team called it a "stepping stone" release.

The breaking changes were deliberately small. In the React 17 release candidate post, the team reported that the event delegation change needed fixes in about 10 modules out of many thousands at Facebook. The other breaking changes touched fewer than 20 components out of more than 100,000. So most apps need a handful of fixes, and the real work is finding them.

Change in React 17 What it can break Fix
Event pooling removed Almost nothing; e.persist() calls become dead code Delete e.persist() when you next touch the file
Events delegated to the root container, not document document listeners that expected every React event to reach them Register those listeners in the capture phase
onScroll no longer bubbles Parent handlers that caught scrolls from child elements Attach the handler to the element that scrolls
onFocus and onBlur use focusin and focusout Rarely anything, since bubbling is unchanged Usually none
Capture events use the browser's capture phase Code that depends on the order of React and native listeners Retest that ordering
useEffect cleanup runs asynchronously Cleanup that reads ref.current Copy the ref value inside the effect
forwardRef and memo components throw on undefined Components that returned nothing by accident Return null
Component stacks built from native stack frames Render code with side effects, which may run again after an error Keep render functions pure
Private exports removed Old React Native for Web versions, ReactTestUtils.SimulateNative Upgrade React Native for Web; use React Testing Library

Which version removed event pooling? React 17.0

Up to React 16, React reused its SyntheticEvent objects between events. After your handler returned, React cleared every field on the event so the object could serve the next one. Any code that read the event later got null: a setTimeout, a promise callback or a functional state updater.

function SearchBox() {
  const [query, setQuery] = useState('');

  function handleChange(e) {
    // React 16: the updater runs later, after e has been cleared
    setQuery(() => e.target.value);
  }

  return <input value={query} onChange={handleChange} />;
}

On React 16 you had two fixes. You could call e.persist() at the top of the handler, or copy e.target.value into a variable before the async code ran. The legacy event pooling page shows the persist() version with a timeout.

React 17 removed pooling on the web. The release candidate post gives two reasons: the optimization no longer improves performance in modern browsers, and it confused even experienced React developers. The event object now keeps its fields, so the code above works as written.

What about all those e.persist() calls? They're harmless. In React 17 the method still exists but does nothing. It's still there in current React: the SyntheticEvent source on GitHub keeps persist as an empty function, with a comment that the modern event system doesn't use pooling. Remove the calls when you're in the file anyway. Don't open a pull request just for them.

One scope note. The legacy docs page now says it applies only to React 16 and earlier, and to React Native. If you maintain a mobile app too, don't assume its event objects behave like the web ones. Check the React Native version you run.

Events now attach to the root container, not the document

This is the React 17 breaking change most likely to cause a bug report. In React 16, React attached one listener per event type to the document node. Your onClick handlers never had their own DOM listeners; React dispatched to them from that single listener.

React 17 attaches those listeners to the root DOM container you pass to ReactDOM.render instead. The release candidate post explains why. With everything on document, nesting two React trees broke event handling: calling e.stopPropagation() in the inner tree didn't stop the outer tree from receiving the event. The team cites a bug in the Atom editor as an example.

The fix has a side effect. Suppose your code adds a listener with document.addEventListener, and a React handler calls e.stopPropagation(). In React 16 your listener still fired, because React's own listener sat on document beside it. In React 17 the event stops at the root, so your listener never hears about it.

The fix from the React team is to register that listener in the capture phase:

document.addEventListener('click', handleOutsideClick, { capture: true });

In practice, this shows up most in "click outside to close" logic for dropdowns, modals and menus. Search your codebase for document.addEventListener and window.addEventListener, then check each one against handlers that stop propagation.

Two other effects are worth knowing. If an older jQuery shell wraps a React widget, e.stopPropagation() inside React now stops the event before jQuery sees it, which is what most people expected all along. And portals rendered outside the root container still work, because React also listens on portal containers.

Three event changes that bring React closer to the browser

The release candidate post groups three smaller event changes together. Each one makes React behave more like the DOM.

onScroll no longer bubbles. In React 16, a parent's onScroll fired when a scrollable child scrolled. Native scroll events don't bubble, so this surprised people. If a parent component relied on it, move the handler to the element that actually scrolls.

onFocus and onBlur use focusin and focusout under the hood. They match React's existing behavior more closely and sometimes carry extra information. Bubbling stays the same: onFocus has always bubbled in React, and it still does. Most apps see no difference.

Capture events use real browser capture listeners. onClickCapture and the other Capture props now run in the browser's capture phase. If your code mixes React capture handlers with native listeners and depends on their order, retest it.

Effect cleanup now runs after the screen updates

In React 16, when a component unmounted, its useEffect cleanup ran synchronously, before the screen updated. On large transitions, such as switching tabs, all that cleanup work slowed the update down.

React 17 runs effect cleanup asynchronously. When a component unmounts, the cleanup runs after the screen has updated. React 17 also runs every cleanup function across all components before it runs any new effects. React 16 only guaranteed that order within a single component.

Most cleanup code doesn't care. During the short gap, React doesn't fire its warning about setState on an unmounted component, so code that cancels requests or clears intervals can stay as it is.

The pattern that breaks is a cleanup function that reads a mutable ref. By the time the cleanup runs, videoRef.current may already be null. Copy the value inside the effect and use the copy:

useEffect(() => {
  const player = videoRef.current;
  player.play();

  return () => {
    player.pause(); // not videoRef.current.pause()
  };
}, []);

The exhaustive-deps rule in eslint-plugin-react-hooks has warned about this pattern for a long time. If your team runs it, you've probably fixed most of these already. For the rare effect that must run synchronously, the React team suggests useLayoutEffect.

Smaller changes that still count as breaking

forwardRef and memo now throw on undefined

Class and function components already threw an error when they returned undefined. Because of a coding mistake, forwardRef and memo components didn't check. React 17 makes them consistent, so returning undefined from one now throws. If you mean to render nothing, return null.

Component stacks come from native stack frames

Before React 17, component stacks in error messages weren't clickable and were of little use in production. React 17 builds them from native JavaScript stack frames, so you can click through in the console and symbolicate them in production with source maps.

To build the stack, React throws and catches temporary errors inside the components above the failure. That means parts of some render functions and class constructors run again after an error. The React team doesn't expect practical problems, because render code shouldn't have side effects. If yours does, this is one more reason to move it into effects.

Private exports are gone

React 17 removed internal exports that other projects had reached into. Older versions of React Native for Web depended on them and don't work with React 17. Newer versions do.

The undocumented ReactTestUtils.SimulateNative API went too. The release candidate post says it was removed, while the final changelog lists it as deprecated. Either way, don't build tests on it. The React team points to React Testing Library for firing native events.

The new JSX transform arrived in React 17, but only became required in React 19

Many developers remember React 17 as the release where you stopped writing import React from 'react' in every file. That's the new JSX transform. It compiles JSX to helpers from react/jsx-runtime, so JSX works without importing React. You still import React to use Hooks and other exports.

It wasn't a breaking change in 17. The React team's post on the new JSX transform calls it completely optional and backported it to React 16.14.0, 15.7.0 and 0.14.10. Tool support started with Babel 7.9.0, Create React App 4.0.0, Next.js 9.5.3, Gatsby 2.24.5 and TypeScript 4.1. A codemod removes the unused imports:

npx react-codemod update-react-imports

The story changed later. The React 19 upgrade guide makes the new transform a requirement, because features such as ref as a prop depend on it. If you're still on the classic transform, switch now. It costs little on React 17 and removes a blocker for later.

Still running React 17? The path from here

According to react.dev's version list, the last React 17 release was 17.0.2, published on March 22, 2021. The React 17 docs are archived on their own site, and the main docs now describe React 19.

React 18 comes first. The React 18 upgrade guide replaces ReactDOM.render with createRoot. Until you make that switch, the app runs in React 17 mode even on React 18. React 18 also batches state updates everywhere, not just inside React event handlers, and the team calls that a breaking change. Strict Mode now mounts, unmounts and remounts components in development, so effects that assume a single mount will show it.

React 19 comes next. The React team recommends upgrading to React 18.3 first, since it logs warnings for the APIs React 19 removes. That list includes ReactDOM.render, string refs, legacy context, propTypes checks and defaultProps on function components. For the order of work on a production app, see our React 19 upgrade guide.

Two habits make the whole path easier. Ship each major version to production on its own, so a regression points to one change. And fix warnings on the version that still runs, because a warning is cheaper to fix than a crash.

If the same product also ships as a mobile app, plan both codebases together. Our React Native development team can line up the web and mobile upgrades against one dependency map. For a larger web app, our custom software development team can start with the audit described above. That means every document listener, every ref read in a cleanup and every library still pinned to React 17.

FAQ

Is React 17 still supported?

React doesn't publish a support window, but there's been no React 17 release since 17.0.2 on March 22, 2021, according to react.dev's version list. Since then, new features and patch releases have gone to the React 18 and 19 lines. If your app still runs React 17, plan the upgrade rather than waiting for fixes.

Does React 17 work with Internet Explorer 11?

Yes. React 17 still supports Internet Explorer, and its changelog includes a fix for an IE11 error. React 18 dropped Internet Explorer support, and its upgrade guide tells teams that still need IE to stay on React 17. That makes IE11 one of the few good reasons to remain on 17.

Can React 16 and React 17 run on the same page?

They can sit on the same page, but nesting one tree inside the other only becomes safe when both run React 17 or later. That's because React 16 still attaches its listeners to document. The React team built React 17 so a future version could be loaded for one part of an app while the rest stays on 17. For most apps, the team still recommends upgrading everything at once.

Do I have to upgrade to React 17 before React 18 or 19?

No. React 17 isn't a required stop. The React team's guidance is to reach React 18.3 before moving to React 19. Whichever route you take, React 17's breaking changes still apply, so fix the document listeners and cleanup refs in the same pass.

ShareLinkedInXEmail

Related reading

Still on React 17? Get your upgrade path mapped

Map my React upgrade