Skip to content

Instantly share code, notes, and snippets.

@alexlecco
Created May 23, 2020 17:50
Show Gist options
  • Save alexlecco/94f90e83e4216277a02307f2532a0dc5 to your computer and use it in GitHub Desktop.
Save alexlecco/94f90e83e4216277a02307f2532a0dc5 to your computer and use it in GitHub Desktop.
minimum redux dev tools configuration
import React from 'react'
import { render } from 'react-dom'
import { createStore, applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'
import { createLogger } from 'redux-logger'
import thunk from 'redux-thunk'
import reducer from './reducers'
import { getAllProducts } from './actions'
import App from './containers/App'
const middleware = [ thunk ];
if (process.env.NODE_ENV !== 'production') {
middleware.push(createLogger());
}
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
reducer,
composeEnhancer(applyMiddleware(...middleware))
)
store.dispatch(getAllProducts())
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment