Skip to main content
InterviewHubPRO
Section Overview
Q119

Question 119 of 407

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

29%
React Core & Hooks (407 Qs)•Part 5: React Redux State Management (101 - 134)

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

junior LevelMost AskedCode ExampleComponentsState Management

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.