Skip to content

Conversation

t-hamano
Copy link
Contributor

For more information, see the following issue in the Gutenberg project:
WordPress/gutenberg#49308

In WordPress 6.2, React version has been updated from 17 to 18. This causes a warning error to appear in the browser console when using the render function.

In order to get rid of this warning error, we need to do compatible processing regardless of whether you are using React version 17 or 18.

The PR check for the presence of createRoot, which is recommended from React 18, as suggested in this comment, and if it is present, use createRoot instead of render.

@t-hamano
Copy link
Contributor Author

P.S. You will need to set SCRIPT_DEBUG to true in order to see this browser warning error.

Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

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

This is great, thanks for fixing it! I can confirm this PR fixes the console warning ✅

@mikachan mikachan merged commit 9aec9f5 into WordPress:trunk Jul 14, 2023
@t-hamano t-hamano deleted the quality/compatible-react-render branch July 14, 2023 17:27
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