InterviewHubPRO
Section Overview
Q119

Question 119 of 445

Part 5: React Redux State Management (101 - 134)

27%
React & Modern Frontend (445 Qs)•Part 5: React Redux State Management (101 - 134)

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

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:

jsx
import ConnectedComponent from "./containers/ConnectedComponent";

<ConnectedComponent user={"john"} />;

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

javascript
{
user: "john";
}

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