Reduction reaction: composition of containers

I am creating a React + Redux application, I come to the point where I am considering using a container inside another container. I ask myself if this is a good approach, i.e. is this a good practice or should we strictly follow rule 1 of a container with multiple components?

+7
redux react-redux
source share
2 answers

Let me quote Dan Abramov 's article on presentation and container components:

When you notice that some components do not use the details that they receive, but simply redirect them, and you must reprogram all these intermediate components at any time when children need more data, this is a good time to implement some container components. Thus, you can receive data and behavior alerts to the sheet components without burdening the unbound components in the middle of the tree.

... means that it’s perfectly normal to have a container component inside another container component if you feel the need for it.

+15
source share

It is not easy to find which component should remain “dumb” and which component should be aware of the application and become a container. I do not think that the problem / anti-pattern use the container in another. If part of your application is used on different pages, it can be a container, connected and used in different pages / containers. Just keep in mind: this “container component” will be specific to this application.

+1
source share

All Articles