Skip to content

Improve mapStateToProps invariant validation error message #309

@pke

Description

@pke

During refactoring of my stores I more than once hit an invariant violation like this:

Uncaught Invariant Violation: `mapStateToProps` must return an object. Instead received "A string".
Uncaught Invariant Violation: `mapStateToProps` must return an object. Instead received .

It would be nice of the name of the connected component would also be part of the error message

The latter error message above is from an "undefined" return I guess, so it should print that in the error message:
Uncaught Invariant Violation: 'ComponentName mapStateToProps' must return an object. Instead received undefined

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions