diff --git a/src/containers/App.tsx b/src/containers/App.tsx index aa5e7f3..1019374 100644 --- a/src/containers/App.tsx +++ b/src/containers/App.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import { Route } from 'react-router-dom' +import { hot } from 'react-hot-loader' import { I18nProps } from '@i18n' import './App.scss' @@ -13,6 +14,7 @@ import SlideBar from '@containers/Sidebar' export interface AppProps extends I18nProps { } +@hot(module) export default class App extends React.Component { render () { const routes = [ diff --git a/src/index.ts b/src/index.ts index a37bde7..bc29696 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,7 +24,6 @@ OfflinePluginRuntime.install({ // Reload the webpage to load into the new version window.location.reload() }, - onUpdateFailed: () => { console.error('SW Event:', 'onUpdateFailed') } diff --git a/src/render.tsx b/src/render.tsx index c7e6593..bf5eab7 100644 --- a/src/render.tsx +++ b/src/render.tsx @@ -3,45 +3,21 @@ import { render } from 'react-dom' import { Provider } from 'mobx-react' import { HashRouter } from 'react-router-dom' import { I18nextProvider } from 'react-i18next' -import { AppContainer } from 'react-hot-loader' import { rootStores } from '@lib/createStore' import App from '@containers/App' import i18n from '@i18n' -const rootEl = document.getElementById('root') - -// Hot Module Replacement API -declare let module: { hot: any } - export default function renderApp () { - render( - - - - - - - - - , - rootEl + const rootEl = document.getElementById('root') + const AppInstance = ( + + + + + + + ) - if (module.hot) { - module.hot.accept('./containers/App', () => { - const NewApp = require('./containers/App').default - render( - - - - - - - - - , - rootEl - ) - }) - } + render(AppInstance, rootEl) }