I cannot use the redux-devtools extension with syncHistoryWithStore with reaction-router-redux. The error I get is: Uncaught TypeError: store.getState is not a function.
syncHistoryWithStore @ sync.js: 38 (anonymous function) @ store.js: 30
my store.js
import { createStore, applyMiddleware, compose } from 'redux';
import { syncHistoryWithStore } from 'react-router-redux';
import { browserHistory } from 'react-router';
import thunkMiddleware from 'redux-thunk';
import createLogger from 'redux-logger';
import rootReducer from './reducers/reducers';
import devTools from 'remote-redux-devtools';
const loggerMiddleware = createLogger()
import data from './dummydata/data'
const initialState = {
data
};
const store = function configureStore(initialState) {
const storeCreator = createStore(rootReducer, initialState,
window.devToolsExtension && window.devToolsExtension()
);
return storeCreator;
}
export const history = syncHistoryWithStore(browserHistory, store)
export default store;
my rootReducer.js
import { combineReducers } from 'redux'
import { routerReducer } from 'react-router-redux';
function post(state = [], action) {
console.log("state: ", state, "action: ", action);
return state
}
const rootReducer = combineReducers({
post, routing: routerReducer
})
export default rootReducer
my main.js
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import css from './styles/stylesheets/style.css';
import store, { history } from './store';
import Main from './components/Main';
import Index from './components/Index';
import Single from './components/Single';
import GraphChart from './components/GraphChart';
import { Router, Route, IndexRoute } from 'react-router';
const router = (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={Main}>
<IndexRoute component={GraphChart}></IndexRoute>
<Route path="/view" component={Single}></Route>
</Route>
</Router>
</Provider>
)
render(router, document.querySelector('#react-container'));
source
share