Skip to content

Commit

Permalink
add some ES7 sugar, tiny fixes to the React Router 1.0.0-beta2 move
Browse files Browse the repository at this point in the history
  • Loading branch information
knowbody committed Jul 1, 2015
1 parent 5b2661d commit fd5993b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions scripts/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import DocumentTitle from 'react-document-title';

export default class App {
static propTypes = {
params: PropTypes.object.isRequired,
query: PropTypes.object.isRequired
children: PropTypes.object
};

render() {
Expand Down
11 changes: 5 additions & 6 deletions scripts/Root.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { PropTypes } from 'react';
import React, { PropTypes, Component } from 'react';
import { Router, Route } from 'react-router';

import App from './App';
import RepoPage from './pages/RepoPage';
import UserPage from './pages/UserPage';

export default class Root extends React.Component {

export default class Root extends Component {
static propTypes = {
history: PropTypes.object.isRequired
}
Expand All @@ -15,9 +14,9 @@ export default class Root extends React.Component {
const { history } = this.props;
return (
<Router history={history}>
<Route name='explore' path='/' handler={App}>
<Route name='repo' path='/:login/:name' handler={RepoPage} />
<Route name='user' path='/:login' handler={UserPage} />
<Route name='explore' path='/' component={App}>
<Route name='repo' path='/:login/:name' component={RepoPage} />
<Route name='user' path='/:login' component={UserPage} />
</Route>
</Router>
);
Expand Down
2 changes: 1 addition & 1 deletion scripts/components/Explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class Explore extends Component {
};

static contextTypes = {
router: PropTypes.func.isRequired
router: PropTypes.object.isRequired
};

shouldComponentUpdate = shouldPureComponentUpdate;
Expand Down
2 changes: 1 addition & 1 deletion scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ const rootEl = document.getElementById('root');
// but switch to HTML5 history locally.
const history = process.env.NODE_ENV === 'production' ?
new HashHistory() :
new BrowserHistory()
new BrowserHistory();

React.render(<Root history={history} />, rootEl);

0 comments on commit fd5993b

Please sign in to comment.