Skip to content

Commit e307245

Browse files
authored
Merge pull request #2409 from FaberVitale/chore/upgrade-deps-react-#2404
2 parents c9e826f + 77bd929 commit e307245

File tree

106 files changed

+5579
-5150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+5579
-5150
lines changed

.yarn/patches/react-scripts__npm_4.0.2.patch

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"@manaflair/redux-batch": "^1.0.0",
55
"@types/nanoid": "^2.1.0",
66
"@types/react": "^16.9.46",
7-
"@types/react-redux": "^7.1.9",
87
"@types/redux-logger": "^3.0.8",
98
"async-mutex": "^0.3.2",
109
"axios": "^0.20.0",

docs/rtk-query/usage/migrating-to-rtk-query.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ export const selectDataByName = (state: RootState, name: string) =>
210210
state.pokemon.dataByName[name]
211211

212212
// file: src/store.ts noEmit
213+
import { useDispatch } from 'react-redux'
214+
import { EnhancedStore } from '@reduxjs/toolkit'
213215
interface Pokemon {}
214216
type RequestState = 'pending' | 'fulfilled' | 'rejected'
215217

@@ -221,10 +223,14 @@ export type RootState = {
221223
pokemon: typeof initialPokemonSlice
222224
}
223225

226+
export declare const store: EnhancedStore<RootState>
227+
export type AppDispatch = typeof store.dispatch
228+
export declare const useAppDispatch: () => (...args: any[])=> any;
229+
224230
// file: src/hooks.ts
225231
import { useEffect } from 'react'
226-
import { useDispatch, useSelector } from 'react-redux'
227-
import { RootState } from './store'
232+
import { useSelector } from 'react-redux'
233+
import { RootState, useAppDispatch } from './store'
228234
import {
229235
fetchPokemonByName,
230236
selectStatusByName,
@@ -233,7 +239,7 @@ import {
233239

234240
// highlight-start
235241
export function useGetPokemonByNameQuery(name: string) {
236-
const dispatch = useDispatch()
242+
const dispatch = useAppDispatch()
237243
// select the current status from the store state for the provided name
238244
const status = useSelector((state: RootState) =>
239245
selectStatusByName(state, name)

examples/action-listener/counter/.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
SKIP_PREFLIGHT_CHECK=true
1+
SKIP_PREFLIGHT_CHECK=true
2+
# https://github.com/facebook/create-react-app/issues/11940
3+
DISABLE_ESLINT_PLUGIN=true

examples/action-listener/counter/package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"dependencies": {
66
"@reduxjs/toolkit": "^1.8.0",
77
"@types/node": "^12.0.0",
8-
"@types/react": "^17.0.0",
9-
"@types/react-dom": "^17.0.0",
8+
"@types/react": "^18.0.12",
9+
"@types/react-dom": "^18.0.5",
1010
"clsx": "1.1.1",
11-
"react": "^17.0.2",
12-
"react-dom": "^17.0.2",
13-
"react-redux": "7.2.2",
14-
"react-scripts": "4.0.3",
11+
"react": "^18.1.0",
12+
"react-dom": "^18.1.0",
13+
"react-redux": "^8.0.2",
14+
"react-scripts": "5.0.1",
1515
"typescript": "~4.2.4"
1616
},
1717
"scripts": {
@@ -22,9 +22,11 @@
2222
},
2323
"eslintConfig": {
2424
"extends": [
25-
"react-app",
26-
"react-app/jest"
27-
]
25+
"react-app"
26+
],
27+
"rules": {
28+
"react/react-in-jsx-scope": "off"
29+
}
2830
},
2931
"browserslist": {
3032
"production": [
@@ -37,5 +39,8 @@
3739
"last 1 firefox version",
3840
"last 1 safari version"
3941
]
42+
},
43+
"devDependencies": {
44+
"jest-watch-typeahead": "^1.1.0"
4045
}
4146
}

examples/action-listener/counter/src/components/ChangeThemeForm/ChangeThemeForm.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { FormEvent } from 'react'
2-
import { ChangeEvent } from 'react-redux/node_modules/@types/react'
1+
import { FormEvent, ChangeEvent } from 'react'
32
import { useAppDispatch, useAppSelector } from '../../store'
43
import { themeActions, ThemeState } from '../../services/theme/slice'
54
import styles from './changeThemeForm.module.css'
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ReactDOM from 'react-dom'
1+
import ReactDOM from 'react-dom/client'
22
import './index.css'
33
import { store } from './store'
44
import { themeActions } from './services/theme/slice'
@@ -8,4 +8,6 @@ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
88
store.dispatch(themeActions.changeColorScheme('dark'))
99
}
1010

11-
ReactDOM.render(<App />, document.getElementById('root'))
11+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
12+
13+
root.render(<App />)

examples/query/react/advanced/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
SKIP_PREFLIGHT_CHECK=true
1+
SKIP_PREFLIGHT_CHECK=true
2+
DISABLE_ESLINT_PLUGIN=true

examples/query/react/advanced/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
"main": "src/index.tsx",
88
"dependencies": {
99
"@reduxjs/toolkit": "^1.6.0-rc.1",
10-
"react": "17.0.0",
11-
"react-dom": "17.0.0",
12-
"react-redux": "7.2.2",
13-
"react-scripts": "4.0.2"
10+
"react": "^18.1.0",
11+
"react-dom": "^18.1.0",
12+
"react-redux": "^8.0.2",
13+
"react-scripts": "5.0.1"
1414
},
1515
"devDependencies": {
16-
"@types/react": "17.0.0",
17-
"@types/react-dom": "17.0.0",
18-
"@types/react-redux": "7.1.9",
16+
"@types/react": "^18.0.5",
17+
"@types/react-dom": "^18.0.5",
1918
"typescript": "~4.2.4"
2019
},
2120
"eslintConfig": {
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { render } from 'react-dom'
1+
import ReactDOM from 'react-dom/client'
22
import { ApiProvider } from '@reduxjs/toolkit/query/react'
3-
43
import App from './App'
54
import { pokemonApi } from './services/pokemon'
65

76
const rootElement = document.getElementById('root')
8-
render(
7+
8+
const reactRoot = ReactDOM.createRoot(rootElement as HTMLElement)
9+
10+
reactRoot.render(
911
<ApiProvider api={pokemonApi}>
1012
<App />
11-
</ApiProvider>,
12-
rootElement
13+
</ApiProvider>
1314
)

0 commit comments

Comments
 (0)