File tree Expand file tree Collapse file tree 6 files changed +43
-11
lines changed
Expand file tree Collapse file tree 6 files changed +43
-11
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " react-redux-immutable-webpack-ssr-starter" ,
3- "version" : " 2.0 .0" ,
3+ "version" : " 2.1 .0" ,
44 "description" : " React + React-Router + Redux + ImmutableJS + Bootstrap with with Server side rendering, Hot Reload and redux-devtools STARTER" ,
55 "main" : " src/index.js" ,
66 "engines" : {
121121 "react" : " ^15.6.1" ,
122122 "react-bootstrap" : " ^0.31.0" ,
123123 "react-dom" : " ^15.6.1" ,
124- "react-hot-loader" : " ^ 3.0.0-beta.6 " ,
124+ "react-hot-loader" : " 3.0.0-beta-7 " ,
125125 "react-modal" : " ^1.7.7" ,
126126 "react-motion" : " ^0.5.0" ,
127127 "react-notification" : " ^6.7.0" ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import configureStore from './redux/store/configureStore';
1313import { createBrowserHistory } from 'history' ;
1414import { fromJS } from 'immutable' ;
1515import App from './containers/app/App' ;
16+ import ScrollToTop from './components/scrollToTop/ScrollToTop' ;
1617
1718const preloadedState = window . __PRELOADED_STATE__ ;
1819delete window . __PRELOADED_STATE__ ;
@@ -35,7 +36,9 @@ class Root extends Component {
3536 < Provider store = { store } >
3637 < div >
3738 < Router history = { syncedHistory } >
38- < App />
39+ < ScrollToTop >
40+ < App />
41+ </ ScrollToTop >
3942 </ Router >
4043 </ div >
4144 </ Provider >
Original file line number Diff line number Diff line change @@ -4,15 +4,21 @@ import React, {
44 PureComponent
55} from 'react' ;
66import PropTypes from 'prop-types' ;
7+ import {
8+ withRouter
9+ } from 'react-router-dom' ;
710
811class ScrollToTop extends PureComponent {
912 static propTypes = {
1013 children : PropTypes . node ,
11- location : PropTypes . string
14+ location : PropTypes . object
1215 } ;
1316
1417 componentDidUpdate ( prevProps ) {
15- if ( this . props . location !== prevProps . location ) {
18+ const { location : nextLocation } = this . props ;
19+ const { location : prevLocation } = prevProps ;
20+
21+ if ( nextLocation !== prevLocation ) {
1622 window . scrollTo ( 0 , 0 ) ;
1723 }
1824 }
@@ -27,4 +33,4 @@ class ScrollToTop extends PureComponent {
2733 }
2834}
2935
30- export default ScrollToTop ;
36+ export default withRouter ( ScrollToTop ) ;
Original file line number Diff line number Diff line change 33import React , {
44 PureComponent
55} from 'react' ;
6+ import PropTypes from 'prop-types' ;
67import {
78 NavigationBar ,
89 BackToTop
@@ -13,12 +14,19 @@ import MainRoutes from '../../routes/MainRoutes';
1314import { withRouter } from 'react-router' ;
1415
1516class App extends PureComponent {
17+ static propTypes = {
18+ // react-router 4:
19+ location : PropTypes . object ,
20+ match : PropTypes . object
21+ } ;
22+
1623 state = {
1724 navModel : fromJS ( navigationModel )
1825 } ;
1926
2027 render ( ) {
2128 const { navModel } = this . state ;
29+ const { match : { url } } = this . props ;
2230
2331 return (
2432 < div id = "appContainer" >
Original file line number Diff line number Diff line change @@ -4,10 +4,14 @@ import React, {
44 PureComponent
55} from 'react' ;
66import PropTypes from 'prop-types' ;
7+ import {
8+ Jumbotron
9+ } from '../../components' ;
710import AnimatedView from '../../containers/animatedView/AnimatedView' ;
11+ import { Link } from 'react-router-dom' ;
812
913class About extends PureComponent {
10- static propTypes = {
14+ static propTypes = {
1115 currentView : PropTypes . string . isRequired ,
1216 enterAbout : PropTypes . func . isRequired ,
1317 leaveAbout : PropTypes . func . isRequired
@@ -26,9 +30,20 @@ class About extends PureComponent {
2630 render ( ) {
2731 return (
2832 < AnimatedView >
29- < h1 >
30- About
31- </ h1 >
33+ < Jumbotron >
34+ < h1 >
35+ About
36+ </ h1 >
37+ < p >
38+ < Link
39+ className = "btn btn-success btn-lg"
40+ to = { '/' } >
41+ < i className = "fa fa-info" />
42+
43+ go to home
44+ </ Link >
45+ </ p >
46+ </ Jumbotron >
3247 </ AnimatedView >
3348 ) ;
3449 }
Original file line number Diff line number Diff line change @@ -5631,7 +5631,7 @@ react-dom@^15.6.1:
56315631 object-assign "^4.1.0"
56325632 prop-types "^15.5.10"
56335633
5634- react-hot-loader@^ 3.0.0-beta.6 :
5634+ react-hot-loader@3.0.0-beta-7 :
56355635 version "3.0.0-beta.7"
56365636 resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-3.0.0-beta.7.tgz#d5847b8165d731c4d5b30d86d5d4716227a0fa83"
56375637 dependencies :
You can’t perform that action at this time.
0 commit comments