javascript - React-Redux connected component not passing updated props to child component -
child components (mapleftnav, map) not rerendering when application state changed. has parent component (mapview) , several siblings.
assumptions:
1) app state changing , being tracked redux
- the action showing in redux dev tools, updated fields;
- i'm logging vehiclesstate in parent component (mapview), changing;
2) reducer not mutating state (gist here)
-redux dev tools , parent (connect
ed compoent) happily picking changes
case new_messages: return reducevehiclemessagestovehicles(state, action.payload)
and function returns:
return { vehicles: updatedvehicles, traces: updatedtraces, vehiclemessagesloading: messagesloading, }
3) parent component (mapview, gist here) receiving new props not child mapleftnav
i console.log props , change in parent component
i write fake
componentwillreceiveprops (nextprops) {console.log(nextprops)}
, function never fired child mapleftnav component.<mapleftnav mapstate={mainmap} push={push} vehicles={vehiclesstate.vehicles} updatecounter={vehiclesstate.updatecounter} />
4) mapleftnav component, requested: https://gist.github.com/thomasgwatson/36d8f6dbd64b0f6425b4beef56075acd
using react, redux, react-redux bindings, react-redux dev tools, material ui , more. i've used react 18 months , redux two.
when directly connect
redux child components, works fine. when pass them parent component , try pass application state down props, child components don't seem register changes in state.
as understand it, should not have connect
components able use application state held in redux store! tips on source of problems is?
Comments
Post a Comment