Reputation: 3124
I've created a React App using create-react-app and added Redux to it. After adding <Provider store={store} />
only the component that I pass as the argument (the main component) on connect
is receiving the props/state.
Why do the nested components not receive them?
I will not paste the code here because I don't know what is causing the problem. Instead, here is the link to the entire App: https://github.com/KadoBOT/Box.es
Upvotes: 2
Views: 423
Reputation: 7973
Currently you are connect
ing only MainPage or TemplatePage
component, depends on condition. But you dont push props down. Here are couple ways how you can get it in your child components
using connect
> connect(mapStateToProps, mapDispatchToProps)(ChildComponent)
You can pass it explicitly from MainPage or TemplatePage
component
<ItemView {...this.props}/> ... <ItemSidebar {...this.props}/>
Thanks
Upvotes: 2