Skip to content

React 17 to 18 Upgrade Initiative#4

Open
rwa-siteimprove wants to merge 1 commit intomasterfrom
opslevel-react_17_to_18_upgrade_initiative-6994a1c8
Open

React 17 to 18 Upgrade Initiative#4
rwa-siteimprove wants to merge 1 commit intomasterfrom
opslevel-react_17_to_18_upgrade_initiative-6994a1c8

Conversation

@rwa-siteimprove
Copy link

React 17 to 18 Migration Summary

Successfully migrated the swagger-ui repository from React 17 to React 18, implementing all necessary changes to support React 18's new concurrent rendering features and updated APIs.

Changes Implemented

Dependency Updates:

  • Updated React from version 17.0.2 to ^18.2.0
  • Updated ReactDOM from version 17.0.2 to ^18.2.0
  • Updated react-test-renderer from version 17.0.2 to ^18.2.0
  • Replaced @wojtekmaj/enzyme-adapter-react-17 with @wojtekmaj/enzyme-adapter-react-18 (version 0.7.1)

Code Updates:

  • Migrated from ReactDOM.render() to ReactDOM.createRoot() API in the core rendering logic
  • Implemented a WeakMap-based caching mechanism to prevent creating multiple roots on the same DOM node
  • Updated test configuration to use React 18 compatible enzyme adapter
  • Imported createRoot from react-dom/client as required by React 18

Compatibility Notes

All existing lifecycle methods in the codebase already use the UNSAFE_ prefix, making them compatible with React 18's StrictMode. React 18's automatic batching feature is enabled by default and will improve performance for state updates outside of React event handlers. No hydration changes were required as the application does not use server-side rendering. The migration maintains full backward compatibility while enabling access to React 18's new concurrent features like startTransition and useDeferredValue if needed in the future.

@rwa-siteimprove rwa-siteimprove requested a review from a team as a code owner February 5, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants