combineReducer
import { combineReducers } from "redux";
import authentiateReducer from "./authentiateReducer";
import productReducer from "./productReducer";
export default combineReducers({
auth: authentiateReducer,
product: productReducer,
});
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import rootReducer from "./reducers";
let store = createStore(rootReducer, applyMiddleware(thunk));
export default store;
- store에서 가져와서 사용하기
- 어떤 reduce에 있는 state를 읽어올 지 적어줘야 함
const productList = useSelector((state) => state.productList);
const productList = useSelector((state) => state.product.productList);