Skip to content

<Route> component pass props.match as a fresh object even if URL have not changed #7527

@aNyMoRe0505

Description

@aNyMoRe0505

Version

v5.2.0

Test Case

https://codesandbox.io/s/react-router-fki8l?file=/src/App.jsx

Steps to reproduce

In the sandbox above, click the button named Toggle Value and see console

Expected Behavior

A component should not re-render if it wrapped by memo

Actual Behavior

A component re-render because match prop is a new object even if URL have not changed.

Is this a normal behavior ? I just started optimizing my app and I found this to be a big problem for me

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