redux-router icon indicating copy to clipboard operation
redux-router copied to clipboard

Router state duplication

Open smashercosmo opened this issue 9 years ago • 6 comments

It seems to me that there is some overhead with keeping router state. When using redux-react-router we have router state in our app state and also in the component's props. So we have

this.props.router.location this.props.router.component this.props.router.params this.props.router.routes

this.props.params this.props.location this.props.history this.props.routes this.props.route this.props.routeParams

Is there any way to reduce number of props kept?

smashercosmo avatar Sep 18 '15 09:09 smashercosmo

+1

stefvhuynh avatar Sep 21 '15 15:09 stefvhuynh

:+1:

tedpennings avatar Sep 23 '15 04:09 tedpennings

Slightly related, we end up having a huge amount of duplicated state between the redux-router part of our Redux state and the rest of our Redux state. We're sort of in this position because we are using combineReducers for modularity, but that means any routable-bits of our overall application state have to be duplicated between the redux-router state and the rest of our Redux application state. It would be nice to see a more cohesive approach to this.

tedpennings avatar Sep 23 '15 04:09 tedpennings

:+1:

skuridin avatar Nov 07 '15 13:11 skuridin

+1

jineshshah36 avatar Nov 22 '15 19:11 jineshshah36

Just out of curiosity - would something like simply removing:

this.props.params
this.props.location
this.props.history
this.props.routes
this.props.route
this.props.routeParams

Be a solution? Ultimately tucking all those props into the router itself? Changes like this are definitely braking imo - that being said - any thoughts?

wi-ski avatar Feb 05 '17 17:02 wi-ski