We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec0d752 commit 1a6cbefCopy full SHA for 1a6cbef
docs/usage/usage-with-typescript.md
@@ -28,6 +28,17 @@ const rootReducer = combineReducers({})
28
export type RootState = ReturnType<typeof rootReducer>
29
```
30
31
+If you pass the reducers directly to `configureStore()` you can get the `State` type from the store instead.
32
+
33
+```typescript
34
+import { configureStore } from '@reduxjs/toolkit'
35
+import rootReducer from './rootReducer'
36
+const store = configureStore({
37
+ reducer: rootReducer
38
+})
39
+export type RootState = ReturnType<typeof store.getState>
40
+```
41
42
### Getting the `Dispatch` type
43
44
If you want to get the `Dispatch` type from your store, you can extract it after creating the store.
0 commit comments