Skip to content

Upgrade class components to functional components #9712

@joshblack

Description

@joshblack

Why are we doing this?

According to the React team, switching a component from a class component to a functional component is technically a breaking change. This is because class components accept a ref that points to the class instance by default. There is no way to opt-out of this behavior. As a result, if we switched a component to a functional component it would no longer have a ref, and existing code that uses a ref would break. Similarly, using React.forwardRef would produce a component where the ref would no longer point to a class instance and code could similarly break.

We have moved some components over to the new format despite these situations. The rationale at the time was that we weren't intending people to use these parts of a component (specifically class instance methods) and if teams were trying to use the ref to find a node in the document their code would work if we used React.forwardRef.

With v11, it seemed like a great opportunity to convert our remaining class components to the new functional component style with hooks.

Effort size legend
❇️ - sm
✴️ - md
🆘 - lg

Tasks

We would like to convert the following components to functional components that use hooks where appropriate:

Metadata

Metadata

Assignees

No one assigned

    Labels

    planning: umbrellaUmbrella issues, surfaced in Projects views

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    ✅ Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions