Skip to content

Commit b041c14

Browse files
authored
Update store configuration using configureStore in createSlice.mdx
This commit addresses the deprecation of createStore by updating the store configuration in createSlice.mdx to use the recommended configureStore method.
1 parent 7536b8b commit b041c14

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/api/createSlice.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Result's function `getInitialState` provides access to the initial state value g
235235
```ts
236236
import { createSlice, createAction } from '@reduxjs/toolkit'
237237
import type { PayloadAction } from '@reduxjs/toolkit'
238-
import { createStore, combineReducers } from 'redux'
238+
import { configureStore, combineReducers } from 'redux'
239239
240240
const incrementBy = createAction<number>('incrementBy')
241241
const decrementBy = createAction<number>('decrementBy')
@@ -282,13 +282,13 @@ const user = createSlice({
282282
},
283283
})
284284
285-
const reducer = combineReducers({
286-
counter: counter.reducer,
287-
user: user.reducer,
285+
const store = configureStore({
286+
reducer: {
287+
counter: counter.reducer,
288+
user: user.reducer,
289+
},
288290
})
289291
290-
const store = createStore(reducer)
291-
292292
store.dispatch(counter.actions.increment())
293293
// -> { counter: 1, user: {name : '', age: 21} }
294294
store.dispatch(counter.actions.increment())

0 commit comments

Comments
 (0)