Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 877 Bytes

mapStateToProps-prefer-parameters-names.md

File metadata and controls

37 lines (26 loc) · 877 Bytes

Enforces that all mapStateToProps parameters have specific names. (react-redux/mapStateToProps-prefer-parameters-names)

react-redux mapStateToProps function has 2 optional arguments:

  • state
  • ownProps

This rule enforces that all of the provided parameters should follow the above naming conventions.

Rule details

The following pattern is considered incorrect:

const mapStateToProps = (anyOtherName) => {}
connect(function(anyOtherName) {}, null)(App)

The following patterns are considered correct:

const mapStateToProps = (state, ownProps) => {}
const mapStateToProps = (state) => {}
const mapStateToProps = ({isActive}) => {isActive}
connect((state) => state, null)(App)