You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
756 B
30 lines
756 B
import * as React from "react"; |
|
import * as ReactDOM from "react-dom"; |
|
import { AppContainer } from "react-hot-loader"; |
|
|
|
import App from "@app/components/App"; |
|
import { ProvideState, State } from "@app/state"; |
|
|
|
const state = new State(); |
|
state.start(); |
|
|
|
const rootElem = document.getElementById("app"); |
|
|
|
const doRender = (Component: React.ComponentType) => { |
|
ReactDOM.render(( |
|
<AppContainer> |
|
<ProvideState state={state}> |
|
<Component /> |
|
</ProvideState> |
|
</AppContainer> |
|
), rootElem); |
|
}; |
|
|
|
doRender(App); |
|
|
|
if (module.hot) { |
|
module.hot.accept("@app/components/App", () => { |
|
const NextApp = require<any>("@app/components/App").default as typeof App; |
|
doRender(NextApp); |
|
}); |
|
}
|
|
|