Skip to content

Commit 34294e3

Browse files
committed
Update chapter 2
1 parent 1863e84 commit 34294e3

File tree

3 files changed

+6918
-7398
lines changed

3 files changed

+6918
-7398
lines changed

02/hello-react/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"react": "^16.8.6",
7-
"react-dom": "^16.8.6",
8-
"react-scripts": "3.0.0"
6+
"react": "^18.2.0",
7+
"react-dom": "^18.2.0",
8+
"react-scripts": "^5.0.1"
99
},
1010
"scripts": {
1111
"start": "react-scripts start",

02/hello-react/src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
5-
import * as serviceWorker from './serviceWorker';
65

7-
ReactDOM.render(<App />, document.getElementById('root'));
6+
const root = ReactDOM.createRoot(document.getElementById('root'));
87

9-
// If you want your app to work offline and load faster, you can change
10-
// unregister() to register() below. Note this comes with some pitfalls.
11-
// Learn more about service workers: https://bit.ly/CRA-PWA
12-
serviceWorker.unregister();
8+
root.render(
9+
<React.StrictMode>
10+
<App />
11+
</React.StrictMode>
12+
);

0 commit comments

Comments
 (0)