New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapStateToProps should not be called with functional component rendering a connected class component #2024
Comments
I'm not sure what you're trying to describe here, tbh. At my first guess (just reading the description), I assume that the difference in |
I have tried to explain as accurately as possible and provided a codesandbox, but if it is unclear or need more details, I'll be happy to provide them. What I'm pointing is that the two examples in that demo are rendering exactly the same thing (supposedly) but |
@pandaiolo yeah, afraid I don't have time to look at this right now (busy with day job stuff). But, my immediate guess is that:
which sounds like a combination of how React itself works in general for rendering rather than a particular bug in React-Redux. I'll try to look into this at some point, but not sure when. |
Sure, thank you! |
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
Description:
mapStateToProps
function called in the same wayReproduction:
mapStateToProps
in the class component child, when the parent component is a functional component ([APP1]
) but not when the parent is a class component ([APP2]
)Here is the logging, by app, when toggling off connected children (conditional rendering):
With a functional component as parent:
With a class component as parent:
Note:
mapStateToProps
function of a child of that component, because suddenly it was being called with unexpectedstate
and trying to get state on undefined keys.Maybe all of this is a normal consequence of the inherent difference in React rendering functional or class component, but I still wanted to document this in an issue for the record, and see if you have any comment.
Thanks!
What is the expected behavior?
mapStateToProps
should be called consistently (or should it not?)Which browser and OS are affected by this issue?
Chrome OSX
Did this work in previous versions of React Redux?
The text was updated successfully, but these errors were encountered: