-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
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
Redux compose "TypeError: undefined is not an object (evaluating 'last.apply')" #2033
Comments
That sounds as if you're passing in something invalid when creating your store. Please check your store creation code and verify that the call to |
In my case caused because of Redux Dev Tools. By passing undefined to compose it generates this error createStore(
combineReducers({ auth, missions, artworks, artists }),
compose(
applyMiddleware(promiseMiddleware),
__REDUX_DEVTOOLS_EXTENSION__ && __REDUX_DEVTOOLS_EXTENSION__()
),
); |
I got this error from safari and I was able to fix it with this.
|
Fix const middleware = applyMiddleware(
routerMiddleware(browserHistory),
thunkMiddleware,
authStateMiddleware
);
const composeEnhancers =
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
rootReducer,
composeEnhancers(middleware)
); |
The above solution from @ballerabdude worked but the linter complained about store being created twice and a redundant statement. I was able to get this working to remove the linter warnings ...
|
Might help someone in the future... const createStoreWithMiddleware = createStore(
rootReducers,
compose(
applyMiddleware(thunk, logger),
window.navigator.userAgent.includes('Chrome') ?
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() : compose,
),
); |
@WebbizAdmin what does |
@casvil Hey, it allows to apply enhancements to the store, like the devtools above. Nice explenations are Stackoverflow and Redux docs . I actually changed to this package Redux Dev Tools Extention import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
....
....
....
const createStoreWithMiddleware = createStore(
rootReducers,
composeWithDevTools(applyMiddleware(thunk)),
); |
Hey guys. I'm just building the dependencies in a project made with react/redux. And when webpack bundle the main file, the error: "TypeError: undefined is not an object (evaluating 'last.apply')" has been shown on console log.
Is there any solution for this error?
The text was updated successfully, but these errors were encountered: