presentational-container-pattern
Installation
SKILL.md
Container/Presentational Pattern
In React, one way to enforce separation of concerns is by using the Container/Presentational pattern. With this pattern, we can separate the view from the application logic.
When to Use
- Use this when you want a clear separation between data-fetching logic and UI rendering
- This is helpful for making presentational components reusable and easy to test
When NOT to Use
- For small components where the separation into two files adds overhead without meaningful benefit
- When hooks already encapsulate the data logic, making a separate container component redundant
- When the component is a one-off view with no reuse potential for either layer