Skip to content

UNSAFE_ lifecycle functions can no longer be defined more than once via mixins #12830

Closed
@alibosworth

Description

@alibosworth

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

The unsafe lifecycle function aliases in 16.3.2 are not merged when defined more than once because of mixins, triggering an error:

Uncaught Error: ReactClassInterface: You are attempting to define UNSAFE_componentWillReceiveProps on your component more than once. This conflict may be due to a mixin.

To reproduce: rename all cWM, cWRP, and cWU functions with their UNSAFE_ versions in a project where mixins cause those functions to be duplicated

What is the expected behavior?

That these lifecyle function continue to work as expected when called via UNSAFE aliases in 16.3, and if they are not supposed to with regard to redefining/merging, that the migration path documentation is updated to indicate so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions