All files / web index.tsx

0% Statements 0/24
0% Branches 0/2
0% Functions 0/1
0% Lines 0/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                                                                                 
import { ConnectedRouter } from 'connected-react-router';
import { createBrowserHistory } from 'history';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactGA from 'react-ga';
import { HelmetProvider } from 'react-helmet-async';
import { Provider } from 'react-redux';
import { compose } from 'redux';
import getSaga from './getSaga';
import getStore from './getStore';
import App from './modules/app/App';
 
import ApolloClientWrapper from './ApolloClientWrapper';
import './index.css';
 
declare const window: any;
 
const preloaded = window.__REDUX_STATE__;
delete window.__REDUX_STATE__;
 
const history = createBrowserHistory();
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
 
const store = getStore(preloaded, history, composeEnhancers);
 
store.runSaga(getSaga());
 
ReactGA.initialize('UA-43645019-21');
 
history.listen(location => {
  ReactGA.set({ page: location.pathname });
  ReactGA.pageview(location.pathname);
});
 
ReactDOM.hydrate(
  (
    <HelmetProvider>
      <Provider store={store}>
        <ApolloClientWrapper>
          <ConnectedRouter history={history}>
            <App />
          </ConnectedRouter>
        </ApolloClientWrapper>
      </Provider>
    </HelmetProvider>
  ) as any,
  document.getElementById('root') as HTMLElement,
);