일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- nextJS
- middleware
- 기준
- concept
- Interface
- built in object
- typeScript
- 삶
- JavaScript
- node.js
- Redux
- tailwindcss
- web
- useState
- CSS
- API
- hardhat
- graphQL
- evm
- SSR
- bitcoin
- express.js
- HTML
- CLASS
- solidity
- blockchain
- error
- Ethereum
- Props
- REACT
- Today
- Total
ReasonJun
Redux : toolkit API : configureStore() 본문
The configureStore() function in Redux Toolkit is a simplified version of the createStore() function in the original Redux library. It takes care of setting up the store with the middleware you need, and it also includes redux-thunk by default.
Here is the syntax for using configureStore():
import { configureStore } from '@reduxjs/toolkit';
const store = configureStore({
reducer: rootReducer,
});
The reducer parameter is the root reducer of your application. This is the reducer that combines all of your other reducers into a single reducer.
The configureStore() function also takes a number of other options, such as the middleware you want to use, the enhancers you want to use, and the configuration for the Redux DevTools Extension.
Here is a comparison of the configureStore() function in Redux Toolkit and the createStore() function in the original Redux library:
Feature | Redux Toolkit | Original Redux |
Ease of use | Easier to use | More complex |
Features | Includes redux-thunk by default, and also supports other middleware and enhancers | Does not include middleware or enhancers by default |
Flexibility | Less flexible | More flexible |
Here are some additional benefits of using configureStore():
- It makes it easy to set up the Redux DevTools Extension.
- It allows you to use middleware and enhancers without having to write any code.
- It provides a good starting point for your Redux store.
If you are using Redux, I highly recommend using configureStore(). It is a great way to simplify your Redux code and make your application more maintainable.
'Frontend > Redux' 카테고리의 다른 글
Redux : createAsyncThunk (0) | 2023.08.20 |
---|---|
Redux : toolkit : createAction / createReducer (0) | 2023.08.19 |
Redux: toolkit (0) | 2023.08.19 |
Redux : middleware / Thunk (0) | 2023.08.19 |
Redux : Provider / useSelector / useDispatch (0) | 2023.08.19 |