Skip to content

React 19 migration #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks
andrew-ronaldson opened this issue Oct 18, 2024 · 1 comment
Open
2 tasks

React 19 migration #201

andrew-ronaldson opened this issue Oct 18, 2024 · 1 comment
Milestone

Comments

@andrew-ronaldson
Copy link
Contributor

andrew-ronaldson commented Oct 18, 2024

Background

React 19 has officially released and product teams are eager to utilize the new features available in this release. React 19 offers several new features and performance improvements that will help PatternFly stay up-to-date with the latest tools.
PF guidelines state that we will support the last two versions of react. This means PF6 must support both React 17 & 18. This impacts what features we can utilize based on the backwards compatibility. This initiative prioritizes non-breaking changes in PatternFly 6 to enable React 19. Following this effort the PatternFly React 19 enhancements Initiative is intended as the breaking change update that leverage more react features supported in react 18 & 19.

Goals

  • The PatternFly React team will complete all non-breaking changes in order be compatible with React 19 (Sub issues).
  • Set up a testing environment to determine if we can support react, 17, 18 and 19 until our next breaking change.

Considerations

PF guidelines state that we will support the last two versions of react. This means PF6 must support both React 17 & 18. This impacts what features we can utilize based on the backwards compatibility.

Research and references

React 19 source
React upgrade guide
PatternFly React 19 enhancements
React package

PF team of contacts

React: @thatblindgeye

@kmcfaul
Copy link

kmcfaul commented Apr 23, 2025

For ease of updating in extensions, making a basic checklist here of todos.

  • Update peer dependencies to include v17, v18, and v19 for react & react-dom
  • Update jsx compiler option in tsconfig.json to react-jsx
  • Update eslint config to also extend plugin:react/jsx-runtime or turn off the rule react/react-in-jsx-scope
  • Update code to account for the following:
    • useRef now requires an initial argument (for previously empty useRefs, null can be used)
    • directly referencing or accessing props in a ReactElement needs explicit typing. any can be used, or use props interface if the exact element type is known
    • use named imports from react package instead of importing the whole React namespace
    • remove any propTypes or defaultProps in FunctionComponents (defaultProps in class components is still supported)
    • remove any contextTypes or getChildContext
    • remove any string refs (use useRef or a ref callback)
    • replace ReactDOM.render with ReactDOM.createRoot, & ReactDOM.hydrate with ReactDOM.hydrateRoot
    • remove any usages of React.findDOMNode

For testing, locally bump to v19 for react, react-dom, @types/react, @types/react-dom (but don't commit).
The following prereleases of @patternfly contain react 19 enablement if any are needed to bump for testing:
"@patternfly/patternfly": "6.3.0-prerelease.9",
"@patternfly/react-charts": "8.3.0-prerelease.1",
"@patternfly/react-code-editor": "6.3.0-prerelease.1",
"@patternfly/react-core": "6.3.0-prerelease.1",
"@patternfly/react-docs": "7.3.0-prerelease.1",
"@patternfly/react-drag-drop": "6.3.0-prerelease.1",
"@patternfly/react-icons": "6.3.0-prerelease.1",
"@patternfly/react-styles": "6.3.0-prerelease.1",
"@patternfly/react-table": "6.3.0-prerelease.1",
"@patternfly/react-templates": "6.3.0-prerelease.1",
"@patternfly/react-tokens": "6.3.0-prerelease.1",

There is a version of docs-framework available that pulls in the above prereleases if needed - 6.9.11.
Ideally, you shouldn't have to pull in the docs-framework (as the docs build will still fail), and only need to build and verify with react 19 in the module build, or by pulling in the extension/project into the react-seed app with react 19.

Documentation build will fail due to react-ssr-prepass.
Finally, test that v18 still works.

dgdavid added a commit to agama-project/agama that referenced this issue May 2, 2025
Update web dependencies to their latest except React and React Router
DOM, since both has published major versions that should be updated in
separated PRs with their corresponding migrations after [PatternFly
supports React 19](patternfly/pf-roadmap#201).

---

Previous updates:

* #2313
* #2242
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 - on schedule
Development

No branches or pull requests

2 participants