我想问一下如何在redux中的1个文件reducer中导出多个const
myreducers.js
import * as ActionTypes from '../actions/secone'
// PRODUCT TEMPLATE STATE
const productTemplate = (state={records:[], isFetching: false}, action) => {
switch (action.type) {
case ActionTypes.PRODUCT_TEMPLATE_REQUEST:
return { ...state, isFetching: true}
case ActionTypes.PRODUCT_TEMPLATE_SUCCESS:
return {
records: action.response,
isFetching: false,
}
default:
return state;
}
}
// PRODUCT ATTRIBUTE VALUES STATE
const productAttributeValues = (state={records:[], isFetching: false}, action) => {
switch (action.type) {
case ActionTypes.PRODUCT_ATTRIBUTE_VALUES_REQUEST:
return { ...state, isFetching: true}
case ActionTypes.PRODUCT_ATTRIBUTE_VALUES_SUCCESS:
return {
records: action.response,
isFetching: false,
}
default:
return …Run Code Online (Sandbox Code Playgroud)