-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.tsx
executable file
·37 lines (33 loc) · 1.13 KB
/
index.tsx
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
import React from 'react';
import { hydrate } from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import { loadableReady } from '@loadable/component';
import { withSSR } from 'react-i18next';
import i18n from 'shared/libs/i18n';
import Fetch from 'i18next-fetch-backend';
import configureStore from '../shared/configure-store';
import { App } from 'shared/App';
const ExtendedApp = withSSR()(App);
const store = configureStore(window.__initialData__);
const NODE_ENV = process.env.NODE_ENV || 'development';
if(NODE_ENV === 'development') {
const whyDidYouRender = require('@welldone-software/why-did-you-render');
whyDidYouRender(React, {
exclude: [/^Connect/, /^Route/, /^withRouter/, /^Link/, /^NavLink/, /^InnerLoadable/, /^Provider/, /^Switch/, /^Router/]
});
}
loadableReady(() => {
i18n(Fetch);
hydrate(
<Provider store={store}>
<BrowserRouter>
<ExtendedApp
initialLanguage={window.initialLanguage}
initialI18nStore={window.initialI18nStore}
/>
</BrowserRouter>
</Provider>,
document.getElementById('root')
);
});