-
Notifications
You must be signed in to change notification settings - Fork 798
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
React 19 compatibility #37951
Comments
Something else we'll want to consider is switching to the new jsx transform if we're not already using it everywhere. Or, more specifically, whether we want to "polyfill" the react-jsx-runtime script being added to WordPress core in 6.6 for as long as we continue to support 6.5, or continue with letting the jsx runtime be included in our bundles until we drop 6.5. |
As far as I could find, we're not affected by either dropping the So we should prioritize the JSX transform changes and polyfill, and the |
Marking this as done now, I believe I've covered any relevant React 19 compatibility issues.
@zinigor I did want to follow up on this comment specifically though, to say that after looking into it more I believe it's not relevant for us - I commented here: #38271 (comment) |
I can see how I mixed up the two now, thank you! |
In WordPress 6.6, version 18.3 of the React library will be shipped, which will include warnings for deprecations and other changes that will ship in version 19 of React.
We should ensure compatibility with React 19.
propTypes
anddefaultProps
will be removed for functions (thoughdefaultProps
will continue to be supported for class components). IfpropTypes
is in use in a TypeScript file this is absolutely fine.The
propTypes
issue is here (now closed): #38271A fix for defaultProps was made #38274, but another instance still needs fixing:
Warning: Connect(SettingsForm): Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.
(from the Jetpack settings page, ref p1721282023991279-slack-CDLH4C1UZ).Done in #38539
react-test-renderer/shallow
will be removed, and instead can be installed directly fromreact-shallow-renderer
. Related -react-test-renderer
will be deprecated.Done in #38753
unmountComponentAtNode
will be removed,root.unmount()
can be used instead.Done in #38618
ReactDOM.findDOMNode
will be removed and can be replaced with DOM refs.Done in #37408
Typescript related:
The global JSX namespace has been removed in favor of React.JSX.
Done in #38585
JSX transform / polyfill:
Done in #38428
Additionally, in React 18 importing
createRoot
fromreact-dom
was deprecated.Done in #38495
Also, in React 19
ReactDOM.render
will be removed and we'll need to be using ReactDOM.createRoot:Done in #38644
Typescript related, returning anything else from a ref callback will now be rejected by TypeScript.
Done in #38761
Typescript and React related - useRef now requires an argument.
Done in #38763
Error generation with javascript:url usage
Done in #38780
Tasks
findDOMNode
is being removed in React 19 #37408General ref: https://make.wordpress.org/core/2024/06/07/preparation-for-react-19-upgrade/
The text was updated successfully, but these errors were encountered: