Skip to content

Instantly share code, notes, and snippets.

@egorguscha
Created March 19, 2019 09:16
Show Gist options
  • Save egorguscha/4b09020e9e011599f0633405677ac824 to your computer and use it in GitHub Desktop.
Save egorguscha/4b09020e9e011599f0633405677ac824 to your computer and use it in GitHub Desktop.
// index.js
const render = () =>
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<App />
</ConnectedRouter>
</Provider>,
root
)
if (module.hot) {
module.hot.accept(render)
}
render()
// app.js
const AppView = () => (
<>
<RouterConfig />
<GlobalStyle />
</>
)
export const App = hot(module)(AppView)
// routes.js
export const RouterConfig = () => (
<Switch>
{commonRoutes().map((routes, i) => {
return <Route key={i} {...routes} />
})}
</Switch>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment