Help with app structure


Hi Everyone,

I have a very simple question that I guess someone with a little more experience than me will find easy to answer. Let’s suppose we have an Animals collection and we want to have two routes as follows:

/animal/:id (this should display the details of one animal)
/animals (this should list the animals)

Should I create 2 containers? One for AnimalContainer and the other for AnimalsContainer?

Thanks in advance.


I guess you are using React, though this might apply to similar frameworks as well. Following is my personal approach, take it for what it is. In short yes, now let’s walk through this:

One route lists the animals, the other displays specific details.

For listing you need only few selected information. For details you want most if not all the information. This means that there will be two distinct calls to the DB and two distinct displays of information you get back. So two containers/components are a good approach.