reactjs - react redux store is not a function -
const rootreducer = combinereducers({ router: routerstatereducer, todos, }) const createstorewithmiddleware = compose( applymiddleware(thunk), reduxreactrouter({ routes, createhistory }) )(createstore)(reducer); export default function configurestore(initialstate) { const store = createstorewithmiddleware(rootreducer, initialstate)
it giving me createstorewithmiddleware
not function.. why ?
you're executing result of compose
(which returns function). instead of setting createstorewithmiddleware
returned function, setting executed result variable reducer
.
not sure variable reducer
in context since have rootreducer
defined above. code should read:
const createstorewithmiddleware = compose( applymiddleware(thunk), reduxreactrouter({ routes, createhistory }) )(createstore)
doing define createstorewithmiddleware
extended createstore
function, can receive rootreducer
, initialstate
.
Comments
Post a Comment