mapStateToProps
and mapDispatchToProps
often include unused props
#2179
Labels
mapStateToProps
and mapDispatchToProps
often include unused props
#2179
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. ThemapStateToProps
andmapDispatchToProps
don't get checked for unnecessary fields in the way that thePropTypes
definitions do so it can be hard to spot them.For example, the
IDEView
gets theeditorAccessibility
state and allEditorAccessibilityActions
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 withbindActionCreators
is not necessary because you can use the object notation to pass the action creators without binding.The text was updated successfully, but these errors were encountered: