Book a free call

React 18: What Changed and How to Upgrade

React 18 adds concurrent rendering, automatic batching and transitions to the React library. Learn what changed, what it fixes, and how to upgrade safely.

Hertiv engineering teamReviewed by a senior engineer
7 min read
React 18: What Changed and How to Upgrade
On this page

Short answer

React 18 is a major release that adds concurrent rendering, automatic batching and transitions, letting React prioritise urgent updates such as typing while slower work runs in the background. Upgrading means switching to the new createRoot API, checking dependencies, and testing interactive screens before rolling out.

What is React 18?

React 18 is a major release of the React JavaScript library that adds concurrent rendering to the way React updates the screen. It was released in 2022 and changed how React schedules work, while keeping most existing component code working without rewrites.

The headline change is that React can now mark some updates as urgent and others as transitions. Urgent updates, such as typing in a field or clicking a button, are handled first. Transition updates, such as filtering a long list or switching a view, can be interrupted and resumed, so the interface stays responsive while heavy work runs in the background.

Feature What it does Who benefits
Concurrent rendering React can pause, resume and prioritise work Apps with heavy lists or charts
Automatic batching Groups state updates into one re-render Almost every React app
Transitions Marks some updates as non-urgent Search, filters and tabs
Suspense on the server Streams page parts as they are ready Server-rendered apps
New root API createRoot replaces the old render call Every app that upgrades
Strict Mode checks Mounts effects twice in development Teams catching side-effect bugs

React 18 does not force you to rewrite components. Most of the new behaviour is opt-in, and the upgrade is mostly about switching to the new root API and checking that your dependencies support the release. The rest of this article explains each change and how to adopt it safely.

How does concurrent rendering work?

Concurrent rendering works by letting React interrupt a render, handle something more urgent, and then come back to the interrupted work. In older React versions a render ran to completion once it started, so a slow update could block typing or clicks until it finished.

React now keeps two ideas separate: what is on the screen, and what it is preparing to show next. It can prepare a new version of the interface in the background while the current one stays interactive. When the preparation is done and nothing more urgent has arrived, React commits the new version in one step.

This matters most where a single keystroke triggers a large update. A search box that filters thousands of rows is the classic case: without concurrency, each keystroke waits for the full filter to finish, so typing feels slow. With concurrency, React can keep the input responsive and finish the filter when it can.

You do not turn concurrency on with a switch. You get it by using the new root API and by marking slow updates as transitions, which the next section explains. What is React covers the basics of components and state if you are new to the library.

What is automatic batching, and why does it matter?

Automatic batching means React groups several state updates together and re-renders once, instead of rendering once per update. Before React 18, batching only happened inside React event handlers, such as a click. Updates inside timeouts, promises or native event handlers each triggered their own render.

The practical effect is fewer wasted renders. A data fetch that sets three pieces of state in a row now causes one render instead of three. For most apps the change is invisible, except that interfaces feel slightly faster and render counts drop.

There is one case to watch. If some code depended on the screen updating between two state changes, that code will behave differently now, because the screen only updates after the whole batch. This is rare, and it usually points to code that was reading the DOM too early. The fix is to use flushSync for the specific update that must render at once, and to keep that exception narrow.

Batching also applies to updates that happen in the same tick from different sources, so a handler that fires two state setters and a promise resolution that fires a third can still land in a single render. The rule is simple: React batches unless you explicitly tell it not to.

What are transitions, and how do you use them?

Transitions are React 18's way of marking an update as non-urgent. You wrap the update in startTransition, and React treats it as work that can be interrupted by urgent updates such as typing, clicking or scrolling.

The hook useTransition returns a function and a flag. You call startTransition with the slow update, and the flag, isPending, tells you the transition is still running, so you can show a subtle loading state. The related hook useDeferredValue does the same job for a value: it returns a deferred copy that lags behind the latest value while the urgent update completes.

A good example is a search field. The text the user types is urgent, so it updates at once. The filtered list is a transition, so React can pause it if the user types another character. The result is that typing never stalls, even when the filter itself is slow.

Transitions are not a fix for slow code. If a render takes a long time because of an expensive calculation, you still need to make the calculation cheaper, for example by memoising it or moving it off the main thread. Transitions only decide the order in which work happens. Reasons to use React explains when the library is a good fit for a project in the first place.

How do you upgrade to React 18?

You upgrade to React 18 by updating the packages, switching to the new root API, and then testing the app, especially around effects and third-party libraries. Most upgrades take hours to days for a small app, and longer for a large one with many dependencies.

  1. Update React and React DOM. Install version 18 of both packages, and update the matching type packages if you use TypeScript.
  2. Switch to createRoot. Replace ReactDOM.render with ReactDOM.createRoot, which enables the new rendering behaviour. The old call still exists but shows a warning and does not enable concurrency.
  3. Check your dependencies. Confirm that state libraries, routers, form tools and UI kits support React 18, since some older versions rely on behaviour that changed.
  4. Fix Strict Mode findings. In development, Strict Mode now mounts effects twice to surface side effects that run more than once. Fix the effects it flags rather than removing Strict Mode.
  5. Test interactive flows. Pay attention to search, filters, forms and animations, where batching and concurrency change timing.
  6. Roll out in stages. Ship to a small share of users first, watch error rates and performance, then widen the rollout.

Do not upgrade every dependency at once. Change React first, stabilise, then update libraries one at a time, so a regression has an obvious cause.

Example (hypothetical): upgrading a dashboard app

Example (hypothetical): a team runs an internal dashboard built with React 17. It has 120 components, a search box that filters 4,000 rows, and 8 third-party libraries. Typing in the search box feels slow because each keystroke re-renders the whole table.

The team plans the upgrade in blocks. Three developers work on it, and each block of 20 components takes 2 days to review and test. With 120 components, that is 6 blocks, which comes to 12 days of review work. Two of the 8 libraries need updates, and those take 3 days to test. The total plan is 15 working days, or 3 weeks at 5 days a week.

After the upgrade, the team wraps the table filter in a transition. Typing updates at once, and the table catches up a moment later. The team also fixes two effects that Strict Mode flagged as running twice. Nothing else in the product changes, and the rollout goes to 10 percent of users first, then to everyone after a week without new errors.

The lesson is that the upgrade is mostly a review exercise. The code changes are small, but the checking matters, because batching and concurrency change the timing of updates that used to be predictable.

What are the common mistakes?

The most common mistakes when moving to React 18 are skipping the new root API, ignoring Strict Mode warnings, and using transitions as a substitute for fixing slow renders.

  • Upgrading without createRoot. If you keep the old render call, you get none of the new behaviour, so the upgrade is wasted effort.
  • Removing Strict Mode to silence warnings. The double-effect check exists to find real bugs. Fix the effect instead of hiding the warning.
  • Marking everything a transition. Urgent updates such as typing and clicks should stay urgent, or the interface will feel delayed.
  • Assuming libraries are compatible. Check each dependency's support for React 18 before upgrading, not after a broken build.
  • Reading the DOM right after setState. Batching means the screen may not have updated yet, so code that reads layout too early will see stale values.
  • Skipping staged rollout. Timing changes are hard to catch in tests, so ship to a small group first.

React 18 is a solid step forward for apps with heavy updates, and a low-risk upgrade for simple ones. Start with the root API, test the interactive screens, and add transitions where users actually feel the lag. For help planning the work, custom software development covers how teams scope and deliver upgrades like this.

Key takeaways

  • React 18 adds concurrent rendering, so slow updates can be interrupted by urgent ones like typing
  • Automatic batching groups state updates into a single re-render, cutting wasted renders
  • Transitions mark slow updates as non-urgent, which keeps search and filters responsive
  • Upgrading means switching to createRoot and checking that every dependency supports React 18
  • Strict Mode now mounts effects twice in development to surface side-effect bugs

Frequently asked questions

What is concurrent rendering in React 18?

Concurrent rendering lets React pause a render, handle a more urgent update, and then resume the interrupted work. It keeps the interface responsive during heavy updates, such as filtering a long list, instead of blocking typing or clicks until the render finishes.

Do I have to rewrite my components for React 18?

No. Most existing component code works as it is. The main change is switching from ReactDOM.render to ReactDOM.createRoot, and checking that third-party libraries support React 18. New features such as transitions are opt-in, so you can adopt them screen by screen.

What is automatic batching in React 18?

Automatic batching groups several state updates into one re-render. Before React 18, batching only happened inside React event handlers, so updates in timeouts or promises each caused a separate render. Now React batches those too, unless you use flushSync for a specific update.

When should I use a transition?

Use a transition for updates that are slow but not urgent, such as filtering a long list, switching a tab, or re-rendering a chart after a filter changes. Keep typing, clicking and scrolling urgent, since marking them as transitions would make the interface feel delayed.

What changed in Strict Mode in React 18?

Strict Mode now mounts components, unmounts them, and mounts them again in development, so effects run twice. This surfaces side effects that assume they run once. Fix the flagged effects instead of removing Strict Mode, since the same bug can appear in production.

Is React 18 backwards compatible?

React 18 is largely backwards compatible for component code, but it drops support for Internet Explorer and changes some timing behaviour around batching and effects. Test interactive flows carefully, update dependencies that rely on old behaviour, and roll the upgrade out to a small group of users first.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: software products in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a React 18 upgrade for your app?

A senior engineer replies within one business day. Or see our Custom Software Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call