Redux-devtools-extension: “No store found”

Created on 31 May 2016  Â·  6Comments  Â·  Source: zalmoxisus/redux-devtools-extension

I have the following code in my configureStore.js file :

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

export default function configureStore(initialState){
  return createStore(
    rootReducer,
    initialState,
    applyMiddleware(thunk),
    window.devToolsExtension ? window.devToolsExtension() : f => f
  );
}

The code whera I use Provider and pass the store to provider is :

import 'babel-polyfill';
import React from 'react';
import {render} from 'react-dom';
import {Router, browserHistory} from 'react-router';
import routes from './routes';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
import './assets/sass/main.scss';
import '../node_modules/font-awesome/css/font-awesome.css';

import {loadCourses} from './actions/courseActions';
import {loadAuthors} from './actions/authorActions';
import {Provider} from 'react-redux';
import configureStore from './store/configureStore';

const store = configureStore();
store.dispatch(loadCourses());
store.dispatch(loadAuthors());

render(
  <Provider store={store}><Router history={browserHistory} routes={routes}/></Provider>, document.getElementById("app")
);

But when I run redux extension I see "No store found".

question

Most helpful comment

createStore takes only 3 arguments, the third is the enhancer. That said, it should be used like that:

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

export default function configureStore(initialState){
 return createStore(
 rootReducer,
 initialState,
 compose(
   applyMiddleware(thunk),
   window.devToolsExtension ? window.devToolsExtension() : f => f
 )
);
}

Note that I also imported compose from redux.

All 6 comments

createStore takes only 3 arguments, the third is the enhancer. That said, it should be used like that:

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

export default function configureStore(initialState){
 return createStore(
 rootReducer,
 initialState,
 compose(
   applyMiddleware(thunk),
   window.devToolsExtension ? window.devToolsExtension() : f => f
 )
);
}

Note that I also imported compose from redux.

It worked. Great. Thanks.

I meet this too and has tried @zalmoxisus 's suggestion , but it doest not work!
image

Hey @falltodis,

Maybe you are using an older version of Redux. Passing enhancer as the 3rd parameter is supported only for redux@>=3.1.0. For older versions you should use it like so.

If not, please provide an example repo or jsfiddle to reproduce the problem.

Tks!
The project is based on snowflake and the only change I make is a file named configureStore.js I fork that repo and have pushed my changes. The new repo is this . Sorry for cant privide an example in jsfiddle.

The extension is meant to be used in the browser, so it could inject the script in web page. For React Native you need Remote Redux DevTools, which would send data to the extension.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThinkSalat picture ThinkSalat  Â·  3Comments

Koleok picture Koleok  Â·  4Comments

zalmoxisus picture zalmoxisus  Â·  4Comments

davecarlson picture davecarlson  Â·  4Comments

zalmoxisus picture zalmoxisus  Â·  5Comments