We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I keep running into the error reducer is not a function.
reducer is not a function
Not sure what I'm doing wrong? My state is a plain object and some of the keys within state are Immutable
state
Immutable
redux/modules/rootReducer.js:
import { combineReducers } from 'redux-immutable'; import { routeReducer } from './routeReducer'; export default combineReducers({ routing: routeReducer, });
redux/modules/routeReducer.js:
import Immutable from 'immutable'; import { LOCATION_CHANGE } from 'react-router-redux'; const initialState = Immutable.fromJS({ locationBeforeTransitions: null }); const locationChangeReducer = (state, action) => { return Object.assign({}, state, {locationBeforeTransitions: action.payload}); }; export default function routeReducer(state = initialState, action) { switch (action.type) { case LOCATION_CHANGE: return locationChangeReducer(state, action); default: return state; } }
redux/createStore.js:
import { createStore as _createStore, applyMiddleware, compose } from 'redux'; import createMiddleware from './middleware/clientMiddleware'; import { routerMiddleware } from 'react-router-redux'; import reducer from './modules/reducer'; import { persistState } from 'redux-devtools'; import { DevTools } from 'containers'; export default function createStore(history, client, data) { // Sync dispatched route actions to the history const reduxRouterMiddleware = routerMiddleware(history); const middleware = [createMiddleware(client), reduxRouterMiddleware]; let finalCreateStore; if (_DEVELOPMENT__ && __CLIENT__ && __DEVTOOLS__) { finalCreateStore = compose( applyMiddleware(...middleware), window.devToolsExtension ? window.devToolsExtension() : DevTools.instrument(), persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) )(_createStore); } else { finalCreateStore = applyMiddleware(...middleware)(_createStore); } const store = finalCreateStore(reducer, data); if (__DEVELOPMENT__ && module.hot) { module.hot.accept('./modules/reducer', () => { store.replaceReducer(reducer); }); } return store; }
The text was updated successfully, but these errors were encountered:
Duplicate of #38
Sorry, something went wrong.
No branches or pull requests
I keep running into the error
reducer is not a function
.Not sure what I'm doing wrong? My
state
is a plain object and some of the keys withinstate
areImmutable
redux/modules/rootReducer.js:
redux/modules/routeReducer.js:
redux/createStore.js:
The text was updated successfully, but these errors were encountered: