Can't make it work with redux-thunk
See original GitHub issueHi,
I followed the readme but can’t make it work with redux-thunk.
import { routerReducer as routing } from 'react-router-redux'
import { combineReducers } from 'redux'
import { loadingBarReducer } from 'react-redux-loading-bar'
const rootReducer = combineReducers({
routing,
loadingBar: loadingBarReducer,
});
export default rootReducer;
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk'
import { logger } from 'redux-logger'
import rootReducer from '../reducers'
import { loadingBarMiddleware } from 'react-redux-loading-bar'
export default function configureStore(preloadedState) {
const store = createStore(
rootReducer,
preloadedState,
applyMiddleware(thunk, loadingBarMiddleware(), logger)
);
return store;
}
Also added <LoadingBar />
Can you please tell me where to look?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Writing Logic with Thunks - Redux
In a sense, a thunk is a loophole where you can write any code that needs to interact with the Redux store, ahead...
Read more >Redux thunk function not being executed - Stack Overflow
It works fine for me. import { applyMiddleware, combineReducers, createStore } from 'redux'; import thunk from 'redux-thunk'; ...
Read more >Module not found: Can't resolve 'redux-thunk' #197 - GitHub
I use this package https://github.com/wmonk/create-react-app-typescript with redux 4 I load redux-thunk from master branch npm i reduxjs/redux-thunk#master ...
Read more >redux-thunk - npm
Thunk middleware for Redux. It allows writing functions with logic inside that can interact with a Redux store's dispatch and getState methods.
Read more >Async actions with Redux Thunk middleware in React Native ...
Learned how to implement Redux with redux-thunk middleware in your React Native app. Also learn what are reducers, actions, and store.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nextofsearch It seems that you don’t use
redux-promise-middleware
and thus can’t rely on its action type names.Do you use
fetchData
across the app whenever you need to fetch any data? If yes, you can simply putshowLoading
andhideLoading
calls in it. You can dispatchshowLoading
before dispatchingbeforeActionCreator
andhideLoading
beforesuccessActionCreator
andfailureActionCreator
.I’m going to close the issue because that is not an issue with the lib. Feel free to use the issue to discuss the usage of the lib with
redux-thunk
.@jamby Sorry for the late reply. I created a branch of demo with
axios
. You can take a look at the diff here: https://github.com/mironov/react-redux-loading-bar/compare/gh-pages...demo-axios