Skip to content

Commit

Permalink
Docs: Fixes code example for API connect mapState (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanleung authored and markerikson committed Oct 2, 2019
1 parent 4bc231f commit 31c998a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/api/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export default connect(
The number of declared function parameters of `mapStateToProps` and `mapDispatchToProps` determines whether they receive `ownProps`
> Note: `ownProps` is not passed to `mapStateToProps` and `mapDispatchToProps` if the formal definition of the function contains one mandatory parameter (function has length 1). For example, functions defined like below won't receive `ownProps` as the second argument
> Note: `ownProps` is not passed to `mapStateToProps` and `mapDispatchToProps` if the formal definition of the function contains one mandatory parameter (function has length 1). For example, functions defined like below won't receive `ownProps` as the second argument. If the incoming value of `ownProps` is `undefined`, the default argument value will be used.
```js
function mapStateToProps(state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function mapStateToProps(state) {
}
const mapStateToProps = (state, ownProps = {}) => {
console.log(state) // state
console.log(ownProps) // undefined
console.log(ownProps) // {}
}
```
Expand Down

0 comments on commit 31c998a

Please sign in to comment.