import { createStore, applyMiddleware, compose } from 'redux'
const store = createStore(
reducer,
preloadedState, // <----- 可选,前后端同构的数据同步
compose( // <------------ 还记得吗?compose 是从右到左的哦!
applyMiddleware( // <-- 这货也是 Store Enhancer 哦!但这是关乎中间件的增强器,必须置于 compose 执行链的最后
middleware1,
middleware2,
middleware3
),
enhancer3,
enhancer2,
enhancer1
)
)
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment