in React JS by
Q:

What is the use of the ownProps parameter in mapStateToProps() and mapDispatchToProps()?

1 Answer

0 votes
by

If the ownProps parameter is specified, React Redux will pass the props that were passed to the component into your connect functions. So, if you use a connected component:

import ConnectedComponent from './containers/ConnectedComponent';

<ConnectedComponent user={'john'} />

The ownProps inside your mapStateToProps() and mapDispatchToProps() functions will be an object:

{ user: 'john' }

You can use this object to decide what to return from those functions.

Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
asked Jul 2, 2019 in React JS by Venkatshastri
+1 vote
asked May 29, 2019 in Machine Learning by param1987
0 votes
asked Feb 23 in React JS by SakshiSharma
0 votes
asked Feb 8, 2020 in JAVA by rahuljain1
0 votes
+1 vote
asked Mar 2, 2020 in React JS by RShastri
...