Skip to content
This repository was archived by the owner on Apr 11, 2019. It is now read-only.

Commit 5a4aa29

Browse files
committed
Feat: add react hot loader app container
1 parent 6f68734 commit 5a4aa29

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

app/src/containers/AppContainer/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component, PropTypes } from 'react';
22
import { connect } from 'react-redux';
33
import { bindActionCreators } from 'redux';
44
import App from 'grommet-udacity/components/App';
5+
import { AppContainer as ReactHotLoader } from 'react-hot-loader';
56
import { Navbar, AppFooter } from 'components';
67
import * as AppContainerActionCreators from './actions';
78

@@ -11,11 +12,13 @@ class AppContainer extends Component { // eslint-disable-line react/prefer-state
1112
location,
1213
} = this.props;
1314
return (
14-
<App centered={false} inline>
15-
<Navbar pathname={location.pathname} />
16-
{React.cloneElement(this.props.children, this.props)}
17-
<AppFooter />
18-
</App>
15+
<ReactHotLoader>
16+
<App centered={false} inline>
17+
<Navbar pathname={location.pathname} />
18+
{React.cloneElement(this.props.children, this.props)}
19+
<AppFooter />
20+
</App>
21+
</ReactHotLoader>
1922
);
2023
}
2124
}

app/src/routes.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ export const routes = {
6060
const RouterApp = props => (
6161
<ApolloProvider {...props} store={store} client={client}>
6262
<Router
63-
history={history} // Scroll to top on route transitions
64-
onUpdate={() => window.scrollTo(0, 0)} // eslint-disable-line
65-
>
66-
{routes}
67-
</Router>
63+
history={history}
64+
routes={routes}
65+
/>
6866
</ApolloProvider>
6967
);
7068

0 commit comments

Comments
 (0)