I would interested to hear how people are going about structuring the flow of data in their components.
Should I:
use createContainer() to create a single wrapper for my entire app that essentially collects all the data that is required (with some if/else logic to only collect the necessary data based on what page is being called).
use createContainer() wrapper for every single one of my components and collect the data that is only relevant to that component (this will mean that some data will be collected more that once).
I think the idea is to use containers for each component and then place those containers in a parent container for components that share the same data.
ok, probably best to give an example of the issues I’m having, which revolves around haivng to dynamically load components in based on certain criteria.
What I need to do allow the app to decide which page layout it needs to show and then insert a number of different components into the page layout. The app won’t know what component to insert without some additional criteria (perhaps sent down from FlowRouter).
The way that I am doing it is:
FlowRouter renders the first container which gets genenric application data.
Now, there are two problems with this. First problem is that I am passing components down from FlowRouter by specifying {this.props.params.appPageLayout} this does not allow me to pass props into the PageLayout1 component. So, should I be doing an if/else like this instead?:
The second problem is that once I am in the PageLayout1 component, a decision needs to be made automatically about which components are to go inside it. If I do another switch statement, then I will have to repliacte this inside the PageLayout component.
Something doesn’t feel right about the way I’m tackling this, so any help would be appreciated