Skip to content
Back to skills

Presentational Container Pattern

ASecurity

Enforce separation of concerns by separating the **View** (Presentational) from the **Logic** (Container). While Hooks have largely replaced the need for separate Container components, this pattern remains essential for testing, documentation, and managing complex side-effects without polluting UI components.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
developmenttypescriptreacttestingapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add iDorgham/Workspace-Factory --skill presentational-container-pattern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Presentational Container Pattern?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Presentational Container Pattern
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/idorgham-presentational-container-pattern/badge)](https://www.skillsdirectory.com/skills/idorgham-presentational-container-pattern)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
type: Skill
subagents: [core-validator, integrity-bot]
agents: [master-guide, swarm-router]
dependencies: [core-orchestration, global-sync]
version: 1.0.0
---



# πŸ“¦ React Presentational-Container Pattern

## Purpose
Enforce separation of concerns by separating the **View** (Presentational) from the **Logic** (Container). While Hooks have largely replaced the need for separate Container components, this pattern remains essential for testing, documentation, and managing complex side-effects without polluting UI components.

---

## Technique 1 β€” The "Pure View" Component
- **Rule**: Presentational components should have no side-effects and minimal internal state.
- **Protocol**: 
    1. Accept all data and event handlers via props.
    2. Focus solely on DOM structure and styling.
    3. Use `Prop-Types` or `TypeScript` interfaces to strictly define the expected data shape.

---

## Technique 2 β€” The "Smart" Container
- **Rule**: Containers handle data fetching, state management, and business logic.
- **Protocol**: 
    1. Serve as the data source for Presentational components.
    2. Contain all `useEffect`, `useQuery`, and state orchestration.
    3. Render the Presentational component, passing down the required props.

---

## πŸ›‘οΈ Critical Failure Modes (Anti-Patterns)
| Anti-Pattern | Result | Correction |
| :--- | :--- | :--- |
| **Styling in Container** | Logic/UI entanglement | Move all CSS/Layout logic into the Presentational component. |
| **Fetching in View** | Hard to test | Extract all API calls into the Container or a Custom Hook. |
| **Logic-Heavy Props** | Fragile View | Ensure the Container transforms complex objects into the primitives/simple objects the View expects. |

---

## Success Criteria (Presentational-Container QA)
- [ ] Presentational components can be rendered in isolation (e.g., Storybook) with mock props.
- [ ] Containers have 0% CSS or styling logic.
- [ ] No side-effects (fetching, timers) exist inside the View layer.
- [ ] Multi-platform reuse is possible (e.g., same Container driving both Web and Mobile Views).

Files in this skill

  • SKILL.md2 KB
  • core.py404 B
  • manifest.yaml212 B
  • tests/test_core.py344 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development β†’

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.