Skip to content

Commit 31c998a

Browse files
duncanleungmarkerikson
authored andcommitted
Docs: Fixes code example for API connect mapState (#1415)
1 parent 4bc231f commit 31c998a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/api/connect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ export default connect(
571571
572572
The number of declared function parameters of `mapStateToProps` and `mapDispatchToProps` determines whether they receive `ownProps`
573573
574-
> 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
574+
> 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.
575575
576576
```js
577577
function mapStateToProps(state) {

docs/using-react-redux/connect-extracting-data-with-mapStateToProps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function mapStateToProps(state) {
184184
}
185185
const mapStateToProps = (state, ownProps = {}) => {
186186
console.log(state) // state
187-
console.log(ownProps) // undefined
187+
console.log(ownProps) // {}
188188
}
189189
```
190190

0 commit comments

Comments
 (0)