我試圖使用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