This is the index.js inside the root folder :
import { createStore, applyMiddleware } from "redux";
import rootReducer from "./reducers/reducers";
const store = applyMiddleware(ReduxPromise)(createStore);
ReactDOM.render(
<Provider store={store(rootReducer)}>
<App />
</Provider>,
document.getElementById("root")
);
To be able to use Redux DevTools I need to add this line of code:
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
I tried this:
import { createStore, applyMiddleware, compose } from "redux";
import rootReducer from "./reducers/reducers";
const initialState = {};
const middleware = [ReduxPromise];
const store = createStore(
rootReducer,
initialState,
compose(
applyMiddleware(...middleware),
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
)
);
ReactDOM.render(
<Provider store={store(rootReducer)}>
<App />
</Provider>,
document.getElementById("root")
);
But then I get the error: TypeError: store is not a function
What am I doing wrong?