You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unexpected key "offline" found in previous state received by the reducer. Expected to find one of the known reducer keys instead: "posts", "comments", "routing". Unexpected keys will be ignored.
#27
Closed
TheoMer opened this issue
Mar 30, 2017
· 1 comment
So, there appears to be am issue with combineReducers (See attached error image). My code is as follows:
index.js
import { combineReducers } from 'redux';
import { routerReducer } from 'react-router-redux'; // we need this for react-router
import posts from './posts';
import comments from './comments';
const rootReducer = combineReducers({ posts, comments, routing: routerReducer });
export default rootReducer;
posts.js
function posts(state = [], action) {
switch (action.type) {
case 'FETCH_POSTS':
return action.payload;
case 'INCREMENT_LIKES' :
const i = action.index;
return state;
default:
return state;
}
}
export default posts;
comments.js
function comments(state = {}, action) {
if (action.type === 'FETCH_COMMENTS') {
return action.payload;
} else if (action.type === 'ADD_COMMENT') {
return state;
} else if (action.type === 'REMOVE_COMMENT') {
return state;
};
return state;
}
export default comments;
So, there appears to be am issue with combineReducers (See attached error image). My code is as follows:
index.js
posts.js
comments.js
actionCreators.js
The text was updated successfully, but these errors were encountered: