Skip to content

react: legacyRoot is only supported in React <= 18 #1380

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

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/react-testing-library/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ your components.

### `legacyRoot`

**WARNING**: This option is only available when tests run with React 18 and earlier.
Copy link
Member

Choose a reason for hiding this comment

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

AFAIR and please correct me if I'm wrong, using legacyRoot wasn't available for versions before React 18. Also, I think a note here will be nicer in terms of UX.

Suggested change
**WARNING**: This option is only available when tests run with React 18 and earlier.
:::note
This option is only available when tests run with React 18.
:::

Copy link
Member Author

Choose a reason for hiding this comment

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

Legacy root is everything before React 18. We don't officially support React 17 with latest RTL though. But this section is specifically for the React version you have installed not for the RTL version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also: this is not a note but a warning. Feel free to follow-up with an appropriate styling that's specific to our deploy setup.


By default we'll render with support for concurrent features (i.e.
[`ReactDOMClient.createRoot`](https://reactjs.org/docs/react-dom-client.html#createroot)).
However, if you're dealing with a legacy app that requires rendering like in
Expand Down