-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update README.md for @wordpress/element. createRoot not available until WordPress 6.2 #49309
Conversation
Mention that `createRoot()` is not available until React 18/WordPress 6.2
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @helgatheviking! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
This is lovely, I echo @helgatheviking! It could also be worth adding JSX example, like the one @ryanwelcher shared on Twitter: |
Love that! I might even suggest not using |
I also ran into this issue trying to update a script with |
Co-authored-by: Ryan Welcher <[email protected]>
If you have the Gutenberg plugin activated in your installation of wordpress, the page/post editor (e.g. https://yourwebsite.test/wp-admin/post.php?post=63&action=edit) and the site editor (e.g. yourwebsite.test/wp-admin/site-editor.php?) will have the newest published releases of gutenberg and https://make.wordpress.org/core/tag/gutenberg-new/ can keep you up to date if you wish to follow what's in the latest releases of gutenberg. If you don't have the gutenberg plugin activated; you'll still have access to the site editor and page/post editor, it just won't be the newest version. |
extra common elements for clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice revision to the documentation 👍
Add "@SInCE 6.2.0 Introduced in WordPress core." comment.
Mark changes related to React 18 as new and deprecated.
Apply changes from the `npm run docs:build` run.
Revert changes for `createInterpolateElement`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied changes to JSDoc comments to reflect changes between React 18 and 17.
@jsnajdr, is there anything else we should mark as new or deprecated in WP 6.2.0?
Trying again with GitHub UI.
Try again making CI pass 😅
All good with CI, all checks satisfied 🎉 Thank you so much for opening this PR. |
@gziolo Thanks for cleaning it up! |
Mention that
createRoot()
is not available until React 18/WordPress 6.2What?
Adding version-specific information about
createRoot
and an example for mounting an app that works in both WP 6.1 and 6.2.Why?
This PR is necessary, because I spent an entire day wondering why
createRoot
was undefined despite following the example exactly. This is not available prior to React 18/WordPress 6.2 and many plugins/themes will need to support both versions.How?
Explain the version limitations
Testing Instructions
Might warrant another PR because you can't actually drop the example into a WP template to test since the
wp
script isn't loaded until the footer (or so it appears to me since I was gettingwp
undefined errors).To test, I inserted
<div id="greeting">
in a template and then added the script inline: