-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (32 loc) · 801 Bytes
/
index.js
File metadata and controls
37 lines (32 loc) · 801 Bytes
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
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { Provider } from 'react-redux';
import configureStore from './ducks/store';
import { BrowserRouter } from 'react-router-dom';
// Add this import:
import { AppContainer } from 'react-hot-loader';
const store = configureStore()
// Wrap the rendering in a function:
const render = () => {
ReactDOM.render(
// Wrap App inside AppContainer
<AppContainer>
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>
</AppContainer>,
document.getElementById('root')
);
};
// Render once
render();
// Webpack Hot Module Replacement API
if (module.hot) {
module.hot.accept('./App', () => {
render();
});
}