Skip to content

Commit c7392cb

Browse files
authored
docs(act.md): correct ReactDOM to ReactDOMClient (#7156)
* docs(act.md): correct ReactDOMClient to ReactDOM * docs(act.md): switch the import to ReactDOMClient instead
1 parent d418485 commit c7392cb

File tree

1 file changed

+4
-4
lines changed
  • src/content/reference/react

1 file changed

+4
-4
lines changed

src/content/reference/react/act.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ To test the render output of a component, wrap the render inside `act()`:
9090

9191
```js {10,12}
9292
import {act} from 'react';
93-
import ReactDOM from 'react-dom/client';
93+
import ReactDOMClient from 'react-dom/client';
9494
import Counter from './Counter';
9595

9696
it('can render and update a counter', async () => {
@@ -99,7 +99,7 @@ it('can render and update a counter', async () => {
9999

100100
// ✅ Render the component inside act().
101101
await act(() => {
102-
ReactDOM.createRoot(container).render(<Counter />);
102+
ReactDOMClient.createRoot(container).render(<Counter />);
103103
});
104104

105105
const button = container.querySelector('button');
@@ -119,7 +119,7 @@ To test events, wrap the event dispatch inside `act()`:
119119

120120
```js {14,16}
121121
import {act} from 'react';
122-
import ReactDOM from 'react-dom/client';
122+
import ReactDOMClient from 'react-dom/client';
123123
import Counter from './Counter';
124124

125125
it.only('can render and update a counter', async () => {
@@ -174,4 +174,4 @@ global.IS_REACT_ACT_ENVIRONMENT=true
174174

175175
In testing frameworks like [React Testing Library](https://testing-library.com/docs/react-testing-library/intro), `IS_REACT_ACT_ENVIRONMENT` is already set for you.
176176

177-
</Note>
177+
</Note>

0 commit comments

Comments
 (0)