[react-dom] Add support for createRoot(document) in Canary and Experimental release channels#68892
Conversation
…rimental release channels
|
|
||
| /** | ||
| * Replaces `ReactDOM.render` when the `.render` method is called and enables Concurrent Mode. | ||
| * createRoot lets you create a root to display React components inside a browser DOM node. |
There was a problem hiding this comment.
Just copy&paste from reference docs. Didn't add some to the one for document in Canary since we're missing docs for that.
document) in Canary and Experimental release channelscreateRoot(document) in Canary and Experimental release channels
| formState?: ReactFormState | null; | ||
| } | ||
|
|
||
| function createRoot(container: Document, options?: RootOptions): Root; |
There was a problem hiding this comment.
not sure how these things layer together. Does this essentially support Document | Element when using canary and experimental builds?
There was a problem hiding this comment.
Yeah good call. Overloads are annoying anyway so I go with the same pattern we use in react types to augment unions
| export type Container = | ||
| | Element | ||
| | DocumentFragment | ||
| | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS[ | ||
| keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS | ||
| ]; |
|
@eps1lon Thank you for submitting this PR! This is a live comment which I will keep updated. 1 package in this PRCode ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. You can test the changes of this PR in the Playground. Status
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 68892,
"author": "eps1lon",
"headCommitOid": "affa97443421ff6efb2c6795a3f66239972e0480",
"mergeBaseOid": "6051dcae005e4bc3cb54c384deb2b8487b733688",
"lastPushDate": "2024-03-04T22:06:49.000Z",
"lastActivityDate": "2024-03-05T15:43:26.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "react-dom",
"kind": "edit",
"files": [
{
"path": "types/react-dom/canary.d.ts",
"kind": "definition"
},
{
"path": "types/react-dom/client.d.ts",
"kind": "definition"
},
{
"path": "types/react-dom/test/canary-tests.tsx",
"kind": "test"
},
{
"path": "types/react-dom/test/react-dom-tests.tsx",
"kind": "test"
}
],
"owners": [
"MartynasZilinskas",
"theruther4d",
"Jessidhia",
"eps1lon"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "gnoff",
"date": "2024-03-05T15:43:26.000Z",
"isMaintainer": false
}
],
"mainBotCommentID": 1977592954,
"ciResult": "pass"
} |
|
🔔 @MartynasZilinskas @theruther4d @Jessidhia — please review this PR in the next few days. Be sure to explicitly select |
|
@gnoff Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |

Types for react/react#25426