I am building an React+Redux application, I come to the point where I am considering to use a container inside another container. I am asking myself if this is a good approach, ie. is it good practice, or should we strictly follow the rule of 1 container with several components ?
相关问题
- Redux action dispatch not working
- “No reducer provided for key X” console.error in r
- How does react decide to rerender a component
- How to access the redux store within the redux for
- Spread operator overwriting elements in new object
相关文章
- Cannot find module 'redux' 怎么解决?
- redux-saga: How to create multiple calls/side-effe
- withNavigation can only be used on a view hierarch
- How to set a test for multiple fetches with Promis
- Apollo Client Cache vs. Redux
- How to use object spread with nested properties?
- React Native - ReactNavigation.addNavigationHelper
- Can TypeScript's `readonly` fully replace Immu
It's not easy to find which component should stay "dumb" and which component should be aware of application and become a container. I don't think it's a problem / anti-pattern to use a container in another one. If a part of your application is used on different pages it can be a container, be connected and use in differents pages/containers, Just be aware : this "container component" will specific to this application
Let me quote Dan Abramov's article about presentational- and container- components:
...meaning it is perfectly fine to have a container component inside another container component if you feel the need for it.