Skip to content

Migrate codebase to React 18#334

Open
mirekys wants to merge 3 commits into
inveniosoftware:masterfrom
oarepo:mirekys/react-18-migration
Open

Migrate codebase to React 18#334
mirekys wants to merge 3 commits into
inveniosoftware:masterfrom
oarepo:mirekys/react-18-migration

Conversation

@mirekys
Copy link
Copy Markdown

@mirekys mirekys commented Apr 29, 2026

❤️ Thank you for your contribution!

Description

Migrate react-invenio-forms from React 16 to React 18 following RFC inveniosoftware/rfcs#112.
This PR contains application of following codemods for v18:

  • Upgrades peer dependencies
  • Replaces enzyme adapter for React18 suppoort
  • Removes explicit React imports (update-react-imports codemod)
  • Migrates render-only class components to functions (pure-component codemod)
  • Updates entry points to createRoot (update-react-imports codemod)
  • Bumps Node - >= v22

Prerequisites

To make React 18 linting work, you need to link a local clone of eslint-config-invenio:

gh repo clone inveniosoftware/eslint-config-invenio
gh pr checkout 20
cd eslint-config-invenio
npm link

In this repo:

npm link @inveniosoftware/eslint-config-invenio

Status:

  • All tests pass

Requires:

Part of: inveniosoftware/rfcs#112

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@mirekys mirekys added this to v14 Apr 29, 2026
@mirekys mirekys marked this pull request as draft April 29, 2026 19:08
@mirekys mirekys self-assigned this May 5, 2026
@mirekys mirekys moved this to 🏗 In progress in v14 May 5, 2026
@mirekys mirekys force-pushed the mirekys/react-18-migration branch 3 times, most recently from c142c7c to 013fede Compare May 6, 2026 13:05
mirekys added 3 commits May 8, 2026 10:08
* Upgrades react and react-dom from ^16.13.0 to ^18.3.0
* Requires Node version >=22.0.0
* Applies update-react-imports codemod
* Applies pure-component codemod
* Migrates ReactDOM.render to createRoot API
* Removes unused devDependencies
  (coveralls, expect)
* Not used or needed with Node 22+ & React v18
* Fixes npm audit warnings
@mirekys mirekys force-pushed the mirekys/react-18-migration branch from 013fede to 15963a9 Compare May 8, 2026 08:10
@mirekys mirekys marked this pull request as ready for review May 11, 2026 07:56
Comment thread package.json
"query-string": "^7.0.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react": "^18.3.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in RSK, is it possible to keep React v16 as min version?

Copy link
Copy Markdown
Author

@mirekys mirekys May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer as in RSK, while not entirely impossible (with 18, apps will still probably run, in "legacy" mode, throwing a lot of deprecation warnings), it would be harder to support both 16 and 18, plus it would effectively block any new React 18 features adoption. It would mean we just enable integration of modern npm packages with RDM (having peer deps requiring react >=18). But our codebase basically stays the same as it is now with 16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

3 participants