Skip to content

When to default mapStateToProps and mapDispatchToProps  #367

Closed
@seanstrom

Description

@seanstrom

In #363 we were discussing a potential refactor, and in that refactor I came across some interesting behavior. The connect function will default the mapStateToProps and mapDispatchToProps arguments if necessary. Here are the current conditions:

  • mapStateToProps is defaulted to defaultMapStateToProps when the argument is a falsy value.
  • mapDispatchToProps is defaulted to defaultMapDispatchToProps when the argument isn't a function and is a falsy value.

My question is what is suppose to happen when we pass an invalid truthy value? And should we be making all invalid values default to the default values? One repercussion of not doing so it passing invalid values to wrapActionCreators and then later to bindActionCreators, which will result in that functions thrown error instead of our own error handling. Thoughts?

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