Skip to content

'location' prop not changing in a component with 'withRouter' #5515

@oreqizer

Description

@oreqizer

Version

4.1.2

Test Case

https://codesandbox.io/s/61m9v82r7n

Steps to reproduce

Navigate between Home and Home + query.

Fix

The problem can be fixed by changing Child from being a PureComponent to Component. This is very weird as it has absolutely no connection to either being a child of the <Route /> component, or being the one that is decorated with withRouter.

Expected Behavior

I expect DeepChild's location prop to change whenever the URL changes.

Actual Behavior

DeepChild's prop is not changing despite it being correctly connected to withRouter.

Note

The setup, together with the connect usage, is exactly how I encountered it in my project. I did not test the issue without using connect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions