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.
34 lines
942 B
34 lines
942 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, StateBase } from "@app/state"; |
|
import { WebApiState as StateClass } from "@app/state/web"; |
|
// import log from "@common/logger"; |
|
|
|
// Object.assign(log, { name: "sprinklers3/app", level: "debug" }); |
|
|
|
const state: StateBase = new StateClass(); |
|
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); |
|
}); |
|
}
|
|
|