-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.tsx
37 lines (32 loc) · 803 Bytes
/
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
37
///<reference types="webpack-env" />
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AppContainer } from "react-hot-loader";
import App from "./app";
const reactRoot = document.getElementById('container');
ReactDOM.render(
<AppContainer errorReporter={ErrorReporter}>
<App />
</AppContainer>,
reactRoot
);
function ErrorReporter({ error }) {
console.log(error);
return (
<div>
<h1>{error.message}</h1>
<pre>{error.stack}</pre>
</div>
)
}
if (module.hot) {
module.hot.accept("./app", () => {
const NextApp = require<any>('./app').App;
ReactDOM.render(
<AppContainer>
<App />
</AppContainer>,
reactRoot
);
});
}