Skip to content

Commit 8012b38

Browse files
committed
fix: revert react upgrade in website facebook/docusaurus#7264 (comment)
1 parent 5620e36 commit 8012b38

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

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

+9-3
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)

package.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@
4444
"react-dom": "npm:18.1.0",
4545
"@types/react": "npm:18.0.12",
4646
"@types/react-dom": "npm:18.0.5",
47-
"@types/inquirer": "npm:8.2.1"
47+
"@types/inquirer": "npm:8.2.1",
48+
"website/react": "npm:17.0.2",
49+
"website/react-dom": "npm:17.0.2",
50+
"website/@types/react-dom": "npm:17.0.11",
51+
"website/@types/react": "npm:17.0.11",
52+
"docs/react": "npm:17.0.2",
53+
"docs/react-dom": "npm:17.0.2",
54+
"docs/@types/react-dom": "npm:17.0.11",
55+
"docs/@types/react": "npm:17.0.11"
4856
},
4957
"scripts": {
5058
"build": "yarn build:packages",

website/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"@docusaurus/core": "2.0.0-beta.7",
1313
"@docusaurus/preset-classic": "2.0.0-beta.7",
1414
"classnames": "^2.2.6",
15-
"react": "^18.1.0",
16-
"react-dom": "^18.1.0",
15+
"react": "^17.0.2",
16+
"react-dom": "^17.0.2",
1717
"react-lite-youtube-embed": "^2.0.3",
1818
"remark-typescript-tools": "^1.0.8",
1919
"typescript": "~4.2.4"

yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -27447,8 +27447,8 @@ resolve@~1.19.0:
2744727447
"@docusaurus/preset-classic": 2.0.0-beta.7
2744827448
classnames: ^2.2.6
2744927449
netlify-plugin-cache: ^1.0.3
27450-
react: ^18.1.0
27451-
react-dom: ^18.1.0
27450+
react: ^17.0.2
27451+
react-dom: ^17.0.2
2745227452
react-lite-youtube-embed: ^2.0.3
2745327453
remark-typescript-tools: ^1.0.8
2745427454
typescript: ~4.2.4

0 commit comments

Comments
 (0)