Skip to content

Commit

Permalink
fix: revert react upgrade in website facebook/docusaurus#7264 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
FaberVitale committed Jun 11, 2022
1 parent 5620e36 commit 8012b38
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
12 changes: 9 additions & 3 deletions docs/rtk-query/usage/migrating-to-rtk-query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ export const selectDataByName = (state: RootState, name: string) =>
state.pokemon.dataByName[name]

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

Expand All @@ -221,10 +223,14 @@ export type RootState = {
pokemon: typeof initialPokemonSlice
}

export declare const store: EnhancedStore<RootState>
export type AppDispatch = typeof store.dispatch
export declare const useAppDispatch: () => (...args: any[])=> any;

// file: src/hooks.ts
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { RootState } from './store'
import { useSelector } from 'react-redux'
import { RootState, useAppDispatch } from './store'
import {
fetchPokemonByName,
selectStatusByName,
Expand All @@ -233,7 +239,7 @@ import {

// highlight-start
export function useGetPokemonByNameQuery(name: string) {
const dispatch = useDispatch()
const dispatch = useAppDispatch()
// select the current status from the store state for the provided name
const status = useSelector((state: RootState) =>
selectStatusByName(state, name)
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@
"react-dom": "npm:18.1.0",
"@types/react": "npm:18.0.12",
"@types/react-dom": "npm:18.0.5",
"@types/inquirer": "npm:8.2.1"
"@types/inquirer": "npm:8.2.1",
"website/react": "npm:17.0.2",
"website/react-dom": "npm:17.0.2",
"website/@types/react-dom": "npm:17.0.11",
"website/@types/react": "npm:17.0.11",
"docs/react": "npm:17.0.2",
"docs/react-dom": "npm:17.0.2",
"docs/@types/react-dom": "npm:17.0.11",
"docs/@types/react": "npm:17.0.11"
},
"scripts": {
"build": "yarn build:packages",
Expand Down
4 changes: 2 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@docusaurus/core": "2.0.0-beta.7",
"@docusaurus/preset-classic": "2.0.0-beta.7",
"classnames": "^2.2.6",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-lite-youtube-embed": "^2.0.3",
"remark-typescript-tools": "^1.0.8",
"typescript": "~4.2.4"
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27447,8 +27447,8 @@ resolve@~1.19.0:
"@docusaurus/preset-classic": 2.0.0-beta.7
classnames: ^2.2.6
netlify-plugin-cache: ^1.0.3
react: ^18.1.0
react-dom: ^18.1.0
react: ^17.0.2
react-dom: ^17.0.2
react-lite-youtube-embed: ^2.0.3
remark-typescript-tools: ^1.0.8
typescript: ~4.2.4
Expand Down

0 comments on commit 8012b38

Please sign in to comment.