Skip to content Skip to sidebar Skip to footer

"no Store Found" When Using Redux Chrome Extension

I have a problem with redux chrome extension. I have the following code in my configureStore.js file : import {createStore, applyMiddleware} from 'redux'; import rootReducer from

Solution 1:

I've got the solution from here.

The right code is :

import {createStore, applyMiddleware, compose} from'redux';
import rootReducer from'../reducers/index';
import thunk from'redux-thunk';

exportdefaultfunctionconfigureStore(initialState){
  returncreateStore(
    rootReducer,
    initialState,
    compose(
      applyMiddleware(thunk),
      window.devToolsExtension ? window.devToolsExtension() : f => f
    )
  );
}

Solution 2:

Ok, just checking the official repository of the Redux Dev Tools I found they recommend to use __REDUX_DEVTOOLS_EXTENSION__ instead of devToolsExtension as you are using.

So after just this update my code and de connectino with the plugin start working like a charm.

Here a sample code if it helps anyone:

const enhancers = compose(
  window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  );

const store = createStore(
  rootReducer,
  defaultState,
  enhancers
);

Solution 3:

There is a simpler solution now from the redux-devtools folks. See:

section 1.3 Use redux-devtools-extension package from npm at https://github.com/zalmoxisus/redux-devtools-extension

basically, if you npm install there redux-devtools-extension you can:

import { createStore, applyMiddleware } from'redux';
import { composeWithDevTools } from'redux-devtools-extension';

const store = createStore(reducer, composeWithDevTools(
  applyMiddleware(...middleware),
  // other store enhancers if any
));

In my case I only have one piece of middleware (redux-thunk) but I have an initialState so it looks like this:

const store = createStore(reducer, initalState, composeWithDevTools(applyMiddleware(thunk)))
store.subscribe(() =>console.log("current store: ", JSON.stringify(store.getState(), null, 4)))

Solution 4:

For anyone that none of these worked for, try restarting your server. I had tried for a while and then decided to restart my server. That solved it for me

Solution 5:

As it is given in the original repository https://github.com/zalmoxisus/redux-devtools-extension, you must import compose as a named import and run this compose method by adding the applyMiddleware method as an input;

import { createStore, applyMiddleware, compose } from'redux';
...
...
+ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
+ const store = createStore(reducer, /* preloadedState, */wcomposeEnhancers(
    applyMiddleware(...middleware)
));

Post a Comment for ""no Store Found" When Using Redux Chrome Extension"