我试图使用react-redux-loading-bar来显示从API服务器获取数据期间的加载栏,我没有使用承诺中间件,所以我决定不使用它,该示例说做到这一点 import { showLoading, hideLoading } from 'react-redux-loading-bar'
dispatch(showLoading())
// do long running stuff
创建存储时,设置初始状态(即覆盖reducer自己的默认初始状态)的正常方式是为createStore(how to set initial state in redux)提供第二个参数。但我遗憾的是拼凑起来的东西纠结(原谅混合的比喻),我真的不明白,我不知道从哪里把我需要的初始状态: const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSI
我正在从通用函数调用所有API调用,并且在某些响应中会出现自定义响应头。使用这个头文件,我需要进行另一个API调用。这可以通过使用Redux中间件来实现吗? // function 1
return ApiCaller.post('url').then(json => {
dispatch(someAction(json));
})
// function 2
return A