Steps to reproduce
Configure my store like so, following the directions here:
import { applyMiddleware, compose, createStore } from 'redux'
import thunkMiddleware from 'redux-thunk'
...
if (window.__REDUX_DEVTOOLS_EXTENSION__) {
middleware = [thunkMiddleware, window.__REDUX_DEVTOOLS_EXTENSION__()]
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const enhancer = composeEnhancers(applyMiddleware(...middleware))
store = createStore(reducer, {}, enhancer)
}
Expected Behavior
Store is connected to both redux-thunk and redux devtools
Actual Behavior
Receive the error:
Uncaught (in promise) TypeError: t.apply is not a function
at <anonymous>:3:4545
at <anonymous>:3:985
at <anonymous>:2:838
at compose.js:29
at applyMiddleware.js:41
at <anonymous>:2:1425
at createStore (createStore.js:51)
at index.js:25
at <anonymous>
Using:
Was able to fix this by removing window.__REDUX_DEVTOOLS_EXTENSION__() from the list of enhancers. Looks like the composeEnhancers function will perform this step for me.
Actually I faced the same issue.
I'm using:
OMG, idk how you've managed to figure out the root of the issue, but you saved my day :)
same as apranovich!!! Thank you!
Same as apranovich, thanks
This caused the error:
let calculatorStore = createStore(
calculatorReducer,
0,
applyMiddleware(loggingMiddleware,window.__REDUX_DEVTOOLS_EXTENSION__())
);
How @ktraff said ,we must use compose ,because we want to apply multiple ENCHANCERS:
Solution:
let calculatorStore = createStore(
calculatorReducer,
0,
compose(applyMiddleware(loggingMiddleware),window.__REDUX_DEVTOOLS_EXTENSION__())
);
Most helpful comment
Was able to fix this by removing
window.__REDUX_DEVTOOLS_EXTENSION__()from the list of enhancers. Looks like thecomposeEnhancersfunction will perform this step for me.