Connect is not causing render on ownProps change.
See original GitHub issueMy ownProps is an object containing objects. connect looks something like this:
@connect(
(state,ownProps)=> {
return {
stateProp: state.reducer.favouriteReducer.favourites,
ownProps: ownProps.myProps
};
}
)
Props received:
ownProps.myProps {
subPropOne: {
changedProp: "I was updated why won't you render again? "
}
}
Also its worth mentioning that a grand parent of this component also has a @Connect on it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
javascript - Re-rendering of connect()ed component based on ...
If props received from parent component are shallowly unequal (have changed) and you use ownProps argument, mapStateToProps is also re-evaluated ...
Read more >Connect: Extracting Data with mapStateToProps - React Redux
If any of the fields have changed, then your component will be re-rendered so it can receive the updated values as props. Note...
Read more >Is mapStateToProps causing needless re-renders?
I was recently working on a strange bug at work involving a redux-connected component: a user would hover over a slice of our...
Read more >Redux: Re-rendering Caused by mapDispatchToProps
I've worked on a couple of React/Redux projects now, and it was only recently that I realized some of the re-rendering issues I've...
Read more >Mastering mergeProps in Redux - Peanut Butter JavaScript
Components re-render when props change, and in the second example, the component did not have any props change. onClick is still onClick.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That example doesn’t really make sense.
ownProps
is the props passed directly to the connected component by its parent, like<SomeConnectedComponent a={42} b={123} />
. You don’t need to include those in the return value frommapState
, sinceconnect
will combine the incoming props and themapState
results to form the combined props passed to your real component.Looks like some good guidance and answers were given, so I’m closing this out.