import ReactDOM from "react-dom" ; import { Provider } from "react-redux" ; import { ConnectedRouter } from "connected-react-router" ; import { RouteConfig , renderRoutes } from "react-router-config" ; import { loadableReady } from "@loadable/component" ; import createStore from "../store" ; import routes from "../routes" ; const initialState = window . __INITIAL_STATE__ ; const { store , history } = createStore ( { initialState } ) ; const render = ( Routes ) => ReactDOM . hydrate ( < Provider store = { store } > < ConnectedRouter history = { history } > { renderRoutes ( Routes ) } < /ConnectedRouter> < /Provider>, document.getElementById("react-view")); loadableReady ( ( ) => render ( routes as RouteConfig [ ] ) ) ; /**
 * A temporary workaround for Webpack v5 + HMR, why? see this issue: https://github.com/webpack-contrib/webpack-hot-middleware/issues/390
 */ if ( module . hot ) module . hot . accept ( ) ;