Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
redux:与compose中间件一起设置初始状态_Redux_Redux Middleware - Fatal编程技术网

redux:与compose中间件一起设置初始状态

redux:与compose中间件一起设置初始状态,redux,redux-middleware,Redux,Redux Middleware,在创建存储时,设置覆盖减速器自身默认初始状态的初始状态的常规方法是向createStore提供第二个参数。但不幸的是,我拼凑了一大堆东西。请原谅,这个混合的比喻我真的不明白,我不知道把我想要的初始状态放在哪里: const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const store = createStore( rootReducer, composeEnhancers(

在创建存储时,设置覆盖减速器自身默认初始状态的初始状态的常规方法是向createStore提供第二个参数。但不幸的是,我拼凑了一大堆东西。请原谅,这个混合的比喻我真的不明白,我不知道把我想要的初始状态放在哪里:

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
  rootReducer,
  composeEnhancers(
    applyMiddleware(...middleware)
  )
);

我希望没有人要求查看我的combineReducers和middleware构造代码,因为这更令人尴尬。

仍然使用第二个参数:

const store = createStore(
  rootReducer,
  { your: { initial: { state: {} } } },
  composeEnhancers(
    applyMiddleware(...middleware)
  )
);

仍然使用第二个参数:

const store = createStore(
  rootReducer,
  { your: { initial: { state: {} } } },
  composeEnhancers(
    applyMiddleware(...middleware)
  )
);