Skip to content

Commit 00dac09

Browse files
authored
Update part1c.md
avoid error in example: "main.jsx:12 Warning: You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it."
1 parent 4f42953 commit 00dac09

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/content/1/en/part1c.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ the component won't re-render. We can get the component to re-render by calling
216216
```js
217217
let counter = 1
218218

219+
const root = ReactDOM.createRoot(document.getElementById('root'))
220+
219221
const refresh = () => {
220-
ReactDOM.createRoot(document.getElementById('root')).render(
222+
root.render(
221223
<App counter={counter} />
222224
)
223225
}

0 commit comments

Comments
 (0)