Search code examples
reduxreact-reduxreact-on-rails

Child component rerenders but parent component does not


I have two components , each connected via containers, and both having props mapped via the provided state.

There is one action which results in the child component rerendering while its parent does not. I don't understand how this is possible.

I'm certain that my reducer is not mutating the state. The consequence of this action and the rerendering discrepancy is that a prop in the child component is undefined (because it was successfully removed from the state). But that render function would not run if the parent's render function would rerun as I expect it to.

Why doesn't the parent component's render function get called when the state changes?


Solution

  • This sounds like it's related to an implementation detail in react-redux v4 where children components are updated before parent components. This is changing in react-redux v5, which you can test by installing npm install react-redux@next.