diff --git a/packages/react-dom/src/__tests__/ReactTreeTraversal-test.js b/packages/react-dom/src/__tests__/ReactTreeTraversal-test.js
index 53be0cbdb2d6d..b9de69de85c41 100644
--- a/packages/react-dom/src/__tests__/ReactTreeTraversal-test.js
+++ b/packages/react-dom/src/__tests__/ReactTreeTraversal-test.js
@@ -10,7 +10,9 @@
'use strict';
let React;
-let ReactDOM;
+let ReactDOMClient;
+let act;
+let root;
const ChildComponent = ({id, eventHandler}) => (
{
let outerNode1;
let outerNode2;
- beforeEach(() => {
+ beforeEach(async () => {
React = require('react');
- ReactDOM = require('react-dom');
+ ReactDOMClient = require('react-dom/client');
+ act = require('internal-test-utils').act;
mockFn.mockReset();
@@ -81,7 +84,10 @@ describe('ReactTreeTraversal', () => {
document.body.appendChild(outerNode1);
document.body.appendChild(outerNode2);
- ReactDOM.render(
, container);
+ root = ReactDOMClient.createRoot(container);
+ await act(() => {
+ root.render(
);
+ });
});
afterEach(() => {