Skip to content

Cannot Use Reflux Components With React getDerivedStateFromProps() Static Method #549

@tgv1975

Description

@tgv1975

React 16.4.1
Reflux 6.4.1


On components that extend Reflux.Component, if I use

static getDerivedStateFromProps(props, state) {...}

without implementing componentWillMount() (which is now UNSAFE in React), the Reflux functionality in the component fails, and I get a console error:

image

In the screenshot, below the error, I printed this.componentWillMount from the component's render() method, attesting it comes from the Reflux.Component implementation.

In summary, due to implementing a now UNSAFE componentWillMount(), Reflux.Component cannot be used with the new static method getDerivedStateFromProps().

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