Skip to content

mapStateToProps and mapDispatchToProps often include unused props #2179

Open
@lindapaiste

Description

@lindapaiste

Related to #824 and #2042

I've noticed that a lot of components are accessing props through the Redux connect HOC which are not actually used in the component itself. The mapStateToProps and mapDispatchToProps don't get checked for unnecessary fields in the way that the PropTypes definitions do so it can be hard to spot them.

For example, the IDEView gets the editorAccessibility state and all EditorAccessibilityActions but does not use any of them.

The bulk importing of action creator objects with the import * as EditorAccessibilityActions from '../actions/editorAccessibility'; syntax makes it extra difficult to see which of those actions, if any, are actually used.

This is one of many reasons that the hooks are better, but we still have a lot of class component that can't use hooks yet.

FYI, the mapDispatchToProps setup with bindActionCreators is not necessary because you can use the object notation to pass the action creators without binding.

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