From 31c998ade4e0b8cba1744fb24884befa8eb6467e Mon Sep 17 00:00:00 2001 From: Duncan L Date: Wed, 2 Oct 2019 10:15:24 -0700 Subject: [PATCH] Docs: Fixes code example for API connect mapState (#1415) --- docs/api/connect.md | 2 +- .../connect-extracting-data-with-mapStateToProps.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/connect.md b/docs/api/connect.md index 4ad61e58c..574af6bc3 100644 --- a/docs/api/connect.md +++ b/docs/api/connect.md @@ -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) { diff --git a/docs/using-react-redux/connect-extracting-data-with-mapStateToProps.md b/docs/using-react-redux/connect-extracting-data-with-mapStateToProps.md index c9f3455a1..3a150f49d 100644 --- a/docs/using-react-redux/connect-extracting-data-with-mapStateToProps.md +++ b/docs/using-react-redux/connect-extracting-data-with-mapStateToProps.md @@ -184,7 +184,7 @@ function mapStateToProps(state) { } const mapStateToProps = (state, ownProps = {}) => { console.log(state) // state - console.log(ownProps) // undefined + console.log(ownProps) // {} } ```