Before flagging this has duplicates note that I have checked:
I am trying to integrate redux-thunk
and use replace replaceReducer
on my Redux store at the same time.
Basically, I have somewhere:
const {createStore, applyMiddleware} = require('redux');
const thunk = require('redux-thunk');
createStore(function() {return {}}, applyMiddleware(thunk));
// also tried
// createStore(function() {return {}}, {}, applyMiddleware(thunk));
And later:
store.replaceReducer(someCombinedReducer);
Right now, I am getting an error triggered through the createStore()
line (so before any reducer replacement).
TypeError: middleware is not a function
Versions:
EDIT:
The stack trace is pointing to the applyMiddleware
function exactly as in this question TypeError: middleware is not a function directly from the call I make.
After a good night of sleep and some tweaking.
// thunk here is not undefined but and object
const thunk = require('redux-thunk');
Should be replaced by:
const thunk = require('redux-thunk').default;