-
Not startedstep-1-dependencies
Update react, react-dom, @testing-library/react to 18.3.1 and install
Run this step.
-
Not startedstep-2-react-bc-1
ReactDOM.render() is deprecated in React 18 (the app keeps running in legacy React 17 mode) — replace with createRoot().render()
Run this step.
-
Not startedstep-3-react-bc-2
ReactDOM.hydrate() is deprecated in React 18 (legacy mode) — replace with hydrateRoot()
Run this step.
-
Not startedstep-4-react-bc-3
act() from react-dom/test-utils is deprecated — import act from 'react' (available from React 18.3)
Run this step.
-
Not startedstep-5-react-bc-4
Automatic batching: setState calls in timeouts/promises/native handlers are now batched — may affect code or tests relying on intermediate renders
Review any tests that assert on intermediate render states inside setTimeout, Promise.then, or native event handlers. Wrap those assertions in act() or use flushSync from 'react-dom' to opt out of automatic batching where needed.
-
Not startedstep-6-react-bc-8
ReactDOM.unmountComponentAtNode() is deprecated in React 18 — call root.unmount() on the root returned by createRoot()
Keep the root returned by createRoot(container) and call root.unmount() instead of unmountComponentAtNode(container). In tests, unmount the root the test created (React Testing Library unmounts automatically).
-
Not startedstep-7-react-bc-6
Strict Mode now double-invokes effects (mount → unmount → mount) in development to surface side effects
Audit useEffect, useLayoutEffect, and class lifecycle methods for non-idempotent side effects (network requests, analytics calls, subscriptions). Ensure cleanup functions are implemented so double-invocation does not cause observable problems in development.
-
Not startedstep-8-react-bc-7
ReactDOM.unstable_batchedUpdates is redundant under React 18 automatic batching
With React 18's automatic batching, explicit calls to unstable_batchedUpdates are no longer needed in most cases. Remove them and verify behaviour. If you need to force synchronous rendering, use flushSync from 'react-dom' instead.
-
Not startedstep-9-react-bc-12
Tests that render with react-dom directly need globalThis.IS_REACT_ACT_ENVIRONMENT = true under React 18
In the test setup file (e.g. setupTests.js / jest.setup.js), set globalThis.IS_REACT_ACT_ENVIRONMENT = true; so React 18 knows it runs in an act-aware test environment. React Testing Library ≥ 13 sets this automatically for tests that use it.
-
Not startedstep-10-tests
Update and verify tests
Update any test utilities that changed in the new version, then confirm the full suite passes with verify_migration. This step makes no automated source changes.