我正在尝试在我的redux reducer中使用增强的对象文字语法,其中一些正在工作,而其他人返回空对象。有没有理由为什么'形成'和' auth'在我的例子中工作正常,但'文件'才不是?当我更改文件时#39;对于传统的语法,它工作得很好。当我执行下面的例子时,它只返回一个空对象
import { combineReducers } from 'redux';
import auth from './auth_reducer';
import userReducer from './user_reducer';
import propertyReducer from './property_reducer';
import files from './file_upload_reducer';
import { reducer as form } from 'redux-form';
const appReducer = combineReducers({
/* your app’s top-level reducers */
form,
auth,
user: userReducer,
properties: propertyReducer,
files
})
const rootReducer = (state, action) => {
if (action.type === 'UNAUTH_USER') {
state = undefined
}
return appReducer(state, action)
}
export default rootReducer;