import {Provider} from 'react-redux'
import {createStore, applyMiddleware, compose} from 'redux'
import reducers from './reducers';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducers, composeEnhancers(applyMiddleware()))
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
Answer from Naved Khan on Stack OverflowVideos
» npm install @redux-devtools/extension
» npm install redux-devtools-extension
import {Provider} from 'react-redux'
import {createStore, applyMiddleware, compose} from 'redux'
import reducers from './reducers';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducers, composeEnhancers(applyMiddleware()))
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
It only works when it detects a store on the application you are running. It makes sense since there is nothing to be shown.
Start an application with Redux correctly wired up and it will appear colored and will have very useful information.
EDIT:
I think I found it. Check the code correction. The compose method must be raplace if a __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ exists.
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
let store;
store = createStore(
rootReducer,
initialState,
composeEnhancers(
applyMiddleware(...middleware)
);
No if statements
I faced a similar problem, the following worked for me.
Goto extensions settings for redux Devtools in chrome extensions and check Allow Access to file URLs settings.
Extensions > Redux Devtools > Allow Access to file URLs
I had the same issue where the option REDUX did not appear in the top menu Chrome browser.
- In "Manage Extensions", I made sure Redux DevTools was active and updated.
- I reloaded the page.
- Right click >> Redux DevTools >> Open in a panel(enable in browser settings)
- Right click >> Inspect
Now, verify "Redux" appears in the top menu next to Elements, Console, ... , Lighthouse, etc.
Redux DevTools extension should be working in chrome-devtools.