Skip to content

Commit

Permalink
Remove location and action props from ConnectedRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
brendonpagano committed Dec 27, 2018
1 parent 1131d79 commit 7b22f4d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/ConnectedRouter.js
Expand Up @@ -6,8 +6,7 @@ import { onLocationChanged } from './actions'
import createSelectors from './selectors'

const createConnectedRouter = (structure) => {
const { getIn } = structure
const { getRouter, getLocation } = createSelectors(structure)
const { getLocation } = createSelectors(structure)
/*
* ConnectedRouter listens to a history object passed from props.
* When history is changed, it dispatches action to redux store.
Expand Down Expand Up @@ -90,21 +89,11 @@ const createConnectedRouter = (structure) => {
location: PropTypes.object.isRequired,
push: PropTypes.func.isRequired,
}).isRequired,
location: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
]).isRequired,
action: PropTypes.string.isRequired,
basename: PropTypes.string,
children: PropTypes.oneOfType([ PropTypes.func, PropTypes.node ]),
onLocationChanged: PropTypes.func.isRequired,
}

const mapStateToProps = state => ({
action: getIn(getRouter(state), ['action']),
location: getIn(getRouter(state), ['location']),
})

const mapDispatchToProps = dispatch => ({
onLocationChanged: (location, action) => dispatch(onLocationChanged(location, action))
})
Expand All @@ -127,7 +116,7 @@ const createConnectedRouter = (structure) => {
context: PropTypes.object,
}

return connect(mapStateToProps, mapDispatchToProps)(ConnectedRouterWithContext)
return connect(null, mapDispatchToProps)(ConnectedRouterWithContext)
}

export default createConnectedRouter

0 comments on commit 7b22f4d

Please sign in to comment.