diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponentNestedState-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponentNestedState-test.js
index 09c88ae815e75..596d4a5dfc99f 100644
--- a/packages/react-dom/src/__tests__/ReactCompositeComponentNestedState-test.js
+++ b/packages/react-dom/src/__tests__/ReactCompositeComponentNestedState-test.js
@@ -10,15 +10,17 @@
'use strict';
let React;
-let ReactDOM;
+let ReactDOMClient;
+let act;
describe('ReactCompositeComponentNestedState-state', () => {
beforeEach(() => {
React = require('react');
- ReactDOM = require('react-dom');
+ ReactDOMClient = require('react-dom/client');
+ act = require('internal-test-utils').act;
});
- it('should provide up to date values for props', () => {
+ it('should provide up to date values for props', async () => {
class ParentComponent extends React.Component {
state = {color: 'blue'};
@@ -96,11 +98,16 @@ describe('ReactCompositeComponentNestedState-state', () => {
document.body.appendChild(container);
const logger = jest.fn();
+ const root = ReactDOMClient.createRoot(container);
- void ReactDOM.render(, container);
+ await act(async () => {
+ root.render();
+ });
- // click "light green"
- container.childNodes[0].childNodes[3].click();
+ await act(async () => {
+ // click "light green"
+ container.childNodes[0].childNodes[3].click();
+ });
expect(logger.mock.calls).toEqual([
['parent-render', 'blue'],