Skip to content

Commit c633dda

Browse files
committed
version note
1 parent 59e4639 commit c633dda

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/content/1/en/part1d.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,6 @@ lang: en
77

88
<div class="content">
99

10-
### A note on React version
11-
12-
Version 18 of React was released late March 2022. The code in this course should work with the new React version. However, some libraries might not yet be compatible with React 18. At the moment of writing (4th April) at least the Apollo client used in [part 8](/en/part8) does not yet work with most recent React.
13-
14-
In case you end up in a situation where your application breaks because of library compatibility problems, <i>downgrade</i> to the older React by changing the file <i>package.json</i> as follows:
15-
16-
```js
17-
{
18-
"dependencies": {
19-
"react": "^17.0.2", // highlight-line
20-
"react-dom": "^17.0.2", // highlight-line
21-
"react-scripts": "5.0.0",
22-
"web-vitals": "^2.1.4"
23-
},
24-
// ...
25-
}
26-
```
27-
28-
After the change is made, reinstall dependencies by running
29-
30-
```js
31-
npm install
32-
```
33-
34-
Note that also the file <i>index.js</i> needs to be changed a bit. For React 17 it looks like
35-
36-
```js
37-
import ReactDOM from 'react-dom'
38-
import App from './App'
39-
40-
ReactDOM.render(<App />, document.getElementById('root'))
41-
```
42-
43-
but for React 18 the correct form is
44-
45-
```js
46-
import React from 'react'
47-
import ReactDOM from 'react-dom/client'
48-
49-
import App from './App'
50-
51-
ReactDOM.createRoot(document.getElementById('root')).render(<App />)
52-
```
53-
5410
### Complex state
5511

5612
In our previous example the application state was simple as it was comprised of a single integer. What if our application requires a more complex state?

0 commit comments

Comments
 (0)