Skip to content

Commit 746096b

Browse files
committed
feat: upgrade to react 18, react-router v6, react-redux v8
1 parent 7144094 commit 746096b

File tree

4 files changed

+621
-628
lines changed

4 files changed

+621
-628
lines changed

package.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"author": "Alexander Grischuk <alexgrischuk@gmail.com",
66
"engines": {
7-
"node": ">=10"
7+
"node": ">=16"
88
},
99
"main": "template.json",
1010
"description": "A quick start Create React App template with React Router, Redux, TypeScript, Enzyme and custom ESlint configurations",
@@ -35,18 +35,15 @@
3535
"url": "https://github.com/alexandr-g/cra-template-typescript-redux/issues"
3636
},
3737
"dependencies": {
38-
"@types/enzyme": "^3.10.4",
39-
"@types/jest": "^27.0.0",
38+
"@babel/runtime": "^7.21.5",
39+
"@testing-library/react": "^14.0.0",
4040
"@types/node": "^14.0.0",
41-
"@types/react": "^17.0.0",
42-
"@types/react-dom": "^17.0.0",
43-
"@types/react-redux": "^7.1.5",
44-
"@types/react-router-dom": "^5.1.3",
41+
"@types/react": "^18.2.6",
42+
"@types/react-dom": "^18.2.4",
43+
"@types/react-router-dom": "^5.3.3",
4544
"@types/redux-mock-store": "^1.0.1",
4645
"@typescript-eslint/eslint-plugin": "^5.59.5",
4746
"@typescript-eslint/parser": "5.9.1",
48-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.0",
49-
"enzyme": "^3.11.0",
5047
"eslint": "^8.6.0",
5148
"eslint-config-airbnb-typescript": "^16.1.0",
5249
"eslint-config-prettier": "^8.0.0",
@@ -56,11 +53,11 @@
5653
"eslint-plugin-react": "^7.21.5",
5754
"eslint-plugin-react-hooks": "^4.0.8",
5855
"prettier": "^2.0.0",
59-
"react": "^17.0.0",
60-
"react-dom": "^17.0.0",
61-
"react-redux": "^7.1.3",
62-
"react-router-dom": "^5.1.2",
63-
"react-scripts": "5.0.0",
56+
"react": "^18.2.0",
57+
"react-dom": "^18.2.0",
58+
"react-redux": "^8.0.5",
59+
"react-router-dom": "^6.11.1",
60+
"react-scripts": "^5.0.1",
6461
"redux": "^4.0.5",
6562
"redux-devtools-extension": "^2.13.8",
6663
"redux-mock-store": "^1.5.4",
@@ -113,6 +110,7 @@
113110
"@semantic-release/changelog": "6.0.1",
114111
"@semantic-release/git": "10.0.1",
115112
"@semantic-release/github": "8.0.2",
113+
"@testing-library/jest-dom": "^5.16.5",
116114
"codecov": "3.8.3",
117115
"commitizen": "4.2.4",
118116
"cypress": "9.4.1",

src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { BrowserRouter, Switch, Route } from 'react-router-dom'
2+
import { BrowserRouter, Routes, Route } from 'react-router-dom'
33

44
import { Navbar } from './components/Navbar'
55
import { About } from './pages/About'
@@ -10,10 +10,10 @@ const App: React.FC = () => {
1010
<BrowserRouter>
1111
<Navbar />
1212
<div className="container">
13-
<Switch>
14-
<Route path="/" component={Home} exact />
15-
<Route path="/about" component={About} />
16-
</Switch>
13+
<Routes>
14+
<Route path="/" element={<Home />} />
15+
<Route path="/about" element={<About />} />
16+
</Routes>
1717
</div>
1818
</BrowserRouter>
1919
)

src/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom'
1+
import { createRoot } from 'react-dom/client'
32
import { Provider } from 'react-redux'
43
import store from './store'
54

65
import './index.css'
76

87
import App from './App'
98

10-
ReactDOM.render(
9+
const container = document.getElementById('root') as HTMLDivElement
10+
const root = createRoot(container!)
11+
12+
root.render(
1113
<Provider store={store}>
1214
<App />
13-
</Provider>,
14-
document.getElementById('root')
15+
</Provider>
1516
)

0 commit comments

Comments
 (0)