Skip to content

Commit

Permalink
Reconcile router configuration on containers
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrickouw committed Jan 25, 2016
1 parent 9747168 commit eab1162
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions examples/real-world/containers/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { pushState } from 'redux-router'
import { push } from 'react-router-redux'
import Explore from '../components/Explore'
import { resetErrorMessage } from '../actions'

Expand All @@ -17,7 +17,7 @@ class App extends Component {
}

handleChange(nextValue) {
this.props.pushState(null, `/${nextValue}`)
this.props.push(`/${nextValue}`)
}

renderErrorMessage() {
Expand Down Expand Up @@ -56,7 +56,7 @@ App.propTypes = {
// Injected by React Redux
errorMessage: PropTypes.string,
resetErrorMessage: PropTypes.func.isRequired,
pushState: PropTypes.func.isRequired,
push: PropTypes.func.isRequired,
inputValue: PropTypes.string.isRequired,
// Injected by React Router
children: PropTypes.node
Expand All @@ -65,11 +65,11 @@ App.propTypes = {
function mapStateToProps(state) {
return {
errorMessage: state.errorMessage,
inputValue: state.router.location.pathname.substring(1)
inputValue: state.routing.location.pathname.substring(1)
}
}

export default connect(mapStateToProps, {
resetErrorMessage,
pushState
push
})(App)
4 changes: 2 additions & 2 deletions examples/real-world/containers/RepoPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ RepoPage.propTypes = {
loadStargazers: PropTypes.func.isRequired
}

function mapStateToProps(state) {
const { login, name } = state.router.params
function mapStateToProps(state, props) {
const { login, name } = props.params
const {
pagination: { stargazersByRepo },
entities: { users, repos }
Expand Down
4 changes: 2 additions & 2 deletions examples/real-world/containers/Root.dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component, PropTypes } from 'react'
import { Provider } from 'react-redux'
import { ReduxRouter } from 'redux-router'
import Routes from '../routes'
import DevTools from './DevTools'

export default class Root extends Component {
Expand All @@ -9,7 +9,7 @@ export default class Root extends Component {
return (
<Provider store={store}>
<div>
<ReduxRouter />
<Routes />
<DevTools />
</div>
</Provider>
Expand Down
5 changes: 3 additions & 2 deletions examples/real-world/containers/Root.prod.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { Component, PropTypes } from 'react'
import { Provider } from 'react-redux'
import { ReduxRouter } from 'redux-router'

import Routes from '../routes'

export default class Root extends Component {
render() {
const { store } = this.props
return (
<Provider store={store}>
<ReduxRouter />
<Routes />
</Provider>
)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/real-world/containers/UserPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ UserPage.propTypes = {
loadStarred: PropTypes.func.isRequired
}

function mapStateToProps(state) {
const { login } = state.router.params
function mapStateToProps(state, props) {
const { login } = props.params
const {
pagination: { starredByUser },
entities: { users, repos }
Expand Down

0 comments on commit eab1162

Please sign in to comment.