question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't make it work with redux-thunk

See original GitHub issue

Hi,

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:closed
  • Created 7 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mironovcommented, Apr 14, 2017

@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 put showLoading and hideLoading calls in it. You can dispatch showLoading before dispatching beforeActionCreator and hideLoading before successActionCreator and failureActionCreator .

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.

1reaction
mironovcommented, Apr 13, 2017

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found