Skip to content

Commit 5b354a1

Browse files
authored
Merge pull request #784 from Lemoncode/refactor/update-boiler-plate-readme
update readme
2 parents ee921c2 + fde1816 commit 5b354a1

File tree

1 file changed

+6
-17
lines changed
  • 04-frameworks/01-react/02-base/03-webpack-react

1 file changed

+6
-17
lines changed

04-frameworks/01-react/02-base/03-webpack-react/readme.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,19 @@ export const App = () => {
5252
};
5353
```
5454

55-
- It's time to instantiate that main component, to be able to integrate it with the browser we have to make use of _ReactDOM.render_.
55+
- It's time to instantiate that main component, to be able to integrate it with the browser we have to make use of _createRoot_.
5656

5757
_./src/index.tsx_
5858

5959
```tsx
6060
import React from "react";
61-
import ReactDOM from "react-dom";
61+
import { createRoot } from "react-dom/client";
6262
import { App } from "./app";
6363

64-
ReactDOM.render(
65-
<div>
66-
<App />
67-
</div>,
68-
document.getElementById("root")
69-
);
64+
const rootElement = document.getElementById("root");
65+
const root = createRoot(rootElement);
66+
67+
root.render(<App />);
7068
```
7169

7270
- We are on the right track, but if we try to run this it will fail, since _babel_ does not know how to transform the _jsx_ (remember that this was a sugar, which was actually an XML) into javaScript, in order for babel to be able to understand this we have to install the _preset_ _@babel/preset-react_
@@ -114,12 +112,3 @@ _.babelrc_
114112
```bash
115113
npm start
116114
```
117-
118-
119-
120-
121-
122-
123-
124-
125-

0 commit comments

Comments
 (0)