在发布之前,我试图阅读this post
中的Dan Abramov的超级答案。我的代码中有一个小问题,我很高兴理解我的错误:
1)这是我的索引文件
import { combineReducers } from 'redux-immutable';
import { reducer as formReducer } from 'redux-form';
import appReducer from './appReducer';
import errorReducer from './errorReducer';
import loginReducer from './loginReducer';
import modalReducer from './modalReducer';
import changeRequestReducer from './changeRequestReducer';
import releaseReducer from './releaseReducer';
import releaseReviewReducer from './releaseReviewReducer';
import logoutReducer from './logoutReducer';
import customAvatarReducer from './customAvatarReducer';
import { USER_LOGOUT } from '../actions/logoutActions';
const rootReducer = (state, action) => {
if (action.type === USER_LOGOUT) {
const state = undefined;
}
return reducers(state, action);
};
const reducers = combineReducers({
appReducer,
errorReducer,
loginReducer,
changeRequestReducer,
releaseReducer,
modalReducer,
releaseReviewReducer,
form: formReducer,
logoutReducer,
customAvatarReducer,
rootReducer,
});
export default reducers;
我尝试添加此内容:
Productcategories.fullpath
这是文件的树,
问题是我收到错误消息“您达到了最大调用堆栈大小”
我做错了什么?我不知道是否可能是这个问题,但我们正在使用Immutable.js
UPDATE
这是现在的索引文件
LEFT(Productcategories.Fullpath, CHARINDEX('/',ProductCategories.Fullpath + '/') - 1) as shortpath,
答案 0 :(得分:2)
尝试更改
export default reducers;
到
export default rootReducer;
答案 1 :(得分:0)
您只需要替换位线,请尝试以下代码。
const rootReducer = (state, action) => {
if (action.type === USER_LOGOUT) {
state = [];
}
return reducers(...state, action);
};