-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (32 loc) · 1.07 KB
/
index.js
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
/*eslint-disable import/default */
import React from "react";
import { render } from "react-dom";
import { BrowserRouter } from "react-router-dom";
import configureStore from "./store/configureStore";
import App from "./components/App";
import { callLoadCourses } from "./actions/courseActions";
import { callLoadAuthors } from "./actions/authorActions";
import "./styles/styles.css"; //Webpack can import CSS files too!
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
import "../node_modules/toastr/build/toastr.min.css";
const store = configureStore();
// call THUNKS to get data from API
store.dispatch(callLoadCourses());
store.dispatch(callLoadAuthors());
// REDUX - Provider connects entire app to redux store
render(
<BrowserRouter>
<App store={store} />
</BrowserRouter>,
document.getElementById("app"),
);
if (module.hot) {
module.hot.accept("./components/App", () => {
render(
<BrowserRouter>
<App store={store} />
</BrowserRouter>,
document.getElementById("app"),
);
});
}