Skip to content

Instantly share code, notes, and snippets.

@frankleng
Last active August 1, 2016 19:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankleng/39e5953b78d42fdc070eced38bd2b307 to your computer and use it in GitHub Desktop.
Save frankleng/39e5953b78d42fdc070eced38bd2b307 to your computer and use it in GitHub Desktop.
Avoid RR warning in RHL 3.0
const createRoutes = require('../routes/root').default;
const routes = createRoutes(store);
const render = () => {
const { pathname, search, hash } = window.location;
return match({ routes, location: `${pathname}${search}${hash}` }, () => {
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<Router
render={
(props) =>
<ReduxAsyncConnect
{...props}
helpers={{ apiClient }}
render={applyRouterMiddleware(useScroll())}
/>
}
routes={routes}
history={history}
/>
</Provider>
</AppContainer>,
container
);
});
};
render();
if (module.hot) {
module.hot.accept('routes/root', () => {
setTimeout(render);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment