From 7b22f4db24516adf1b284bdd84be37f6cfc9b3f2 Mon Sep 17 00:00:00 2001 From: Brendon Pagano Date: Thu, 27 Dec 2018 11:06:30 -0200 Subject: [PATCH] Remove location and action props from ConnectedRouter --- src/ConnectedRouter.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/ConnectedRouter.js b/src/ConnectedRouter.js index ce7ccb8b..67d15635 100644 --- a/src/ConnectedRouter.js +++ b/src/ConnectedRouter.js @@ -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. @@ -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)) }) @@ -127,7 +116,7 @@ const createConnectedRouter = (structure) => { context: PropTypes.object, } - return connect(mapStateToProps, mapDispatchToProps)(ConnectedRouterWithContext) + return connect(null, mapDispatchToProps)(ConnectedRouterWithContext) } export default createConnectedRouter