I have a general architectural react-redux question whether to use sub-app approach or not.
At the moment we're developing a generic list/detail view. For the list-view, we retrieve the data with redux-saga and save them to the redux store and connect them to the list component. On paging/search we trigger an action that refreshes those data. A requirement is, that the detail-view can contain list-views of related records (sub-list). The root list-view and the sub-list are visually almost the same, except maybe a search form should not be visible by default and and actions should work differently (only retrieve related data, row-click should not show detail in sub-list...)
To solve this I can think of two solutions:
-1- Reuse Components, share store
We can reuse the list-view container. With a dynamic amount of sub-lists we have to store the data with an id in the store. On paging etc. we have to replace the correct dataset. Garbage Collection has to be handled manually.
-2- Sub-App Approach
As described here: Isolated Subapps We could create an isolated component of the detail/list-view. If we want to have a subgrid we simply include this component. This would be the same as we use for the rootlist-view.
Pro/Cons
For the subapp I see advantage in autonomy. The data could be kept in a separate store and we don't have to implement something "id-based" in the store. We can destroy the subapp and the store is removed as well. On the downside, some data is being retrieved on root level und since we don't want the sub-app to do the same REST call to get those, we need to find a way to send these informations to the sub-app. And a row-click probably has an effect on the root view (redirect) So the sub-app needs to send data and get data of the root element and is therefore not as isolated as I wish.
Does anyone made some valuable experience with any approach? Any feedback would be greatly appreciated!