Skip to content

Does v6 drop support for class components? #8146

@AbrahamLopez10

Description

@AbrahamLopez10

First of all, thank you for making react-router available to the world :)

I'm not sure if this is the best place to ask about this but given that this is monitored by the maintainers I figured I could put my question here.

My question is around the fact that based on the currently available documentation for v6 (the migration/upgrade guide) react-router v6 seems to drop out-of-the-box support for class components and all the codebases that already have plenty of them (like ours) due to the following changes:

  1. Dropping support for the render prop in the Route component, which we are using with react-router v5 to pass params to the component (through props.match.params) of the route.

  2. Replacing the use of History (which was passed as a prop to our components automatically in v5) with the new NavigateFunction and the fact that it's only available through the useNavigate hook which of course is not accessible to class components.

Could someone shed the light on this and the future of react-router for all of us who are using class components and will most likely stick with using them for the foreseeable future?

Thanks in advance.

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