Skip to content

Instantly share code, notes, and snippets.

@germanrdz
Created December 7, 2018 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save germanrdz/0622c1e17934b8f153369bc0577e1e93 to your computer and use it in GitHub Desktop.
Save germanrdz/0622c1e17934b8f153369bc0577e1e93 to your computer and use it in GitHub Desktop.
REDUX_DEVTOOLS_EXTENSION
import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { createStore, applyMiddleware, compose } from 'redux';
import { Provider } from 'react-redux';
import createSagaMiddleware from 'redux-saga';
import rootReducer from 'reducers';
import rootSaga from 'sagas';
import MainContainer from 'components/Main/MainContainer';
import ThankYouContainer from 'screens/ThankYou/ThankYouContainer';
import Error404 from 'screens/Error404/Error404';
const sagaMiddleware = createSagaMiddleware();
const middleware = [sagaMiddleware];
/* eslint-disable no-underscore-dangle */
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(rootReducer, /* preloadedState, */
composeEnhancers(applyMiddleware(...middleware)));
/* eslint-enable */
sagaMiddleware.run(rootSaga);
const App = () => (
<Provider store={store}>
<BrowserRouter>
<Switch>
<Route path="/checkout" component={MainContainer} />
<Route path="/confirm" component={ThankYouContainer} />
<Route component={Error404} status={404} />
</Switch>
</BrowserRouter>
</Provider>
);
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment