Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 850 Bytes

connect-prefer-minimum-two-arguments.md

File metadata and controls

25 lines (16 loc) · 850 Bytes

Enforces that connect function is provided with at least 2 arguments. (react-redux/connect-prefer-minimum-two-arguments)

react-redux mapStateToProps

If you do not supply your own mapDispatchToProps function or object full of action creators, the default mapDispatchToProps implementation just injects dispatch into your component’s props.

This rule enforces that the second argument is provided explicitly.

Rule details

The following pattern is considered incorrect:

connect(mapStateToProps)(Component)

The following patterns are considered correct:

connect(mapStateToProps, mapDispatchToProps, mergeProps)(Component)
connect(mapStateToProps, mapDispatchToProps)(Component)