import * as React from "react" ; import * as ReactDOM from "react-dom" ; import { App } from "./components/App" ; const appElement = document . getElementById ( "app" ) ; const createApp = ( AppComponent ) => { return < AppComponent />; } ; ReactDOM . render ( createApp ( App ) , appElement ) ; interface NodeModule { hot : any ; } declare var module ; interface NodeRequire { < T > ( path ) : T ; } declare var require ; if ( module . hot ) { module . hot . accept ( "./components/App" , ( ) => { console . log ( "hot module reload" ) ; const NextApp = require < { App : typeof App ; } > ( "./components/App" ) . App ; ReactDOM . render ( createApp ( NextApp ) , appElement ) ; } ) ; }