presentational-container-pattern

Separate React data fetching from UI rendering with container components or hooks.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/PMKhai/claude-config --skill presentational-container-pattern-pmkhai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: presentational-container-pattern
Source: https://github.com/PMKhai/claude-config/tree/main/skills/presentational-container-pattern
Command: npx skills add https://github.com/PMKhai/claude-config --skill presentational-container-pattern-pmkhai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Separation of concerns in React apps by decoupling data fetching and business logic from UI rendering to improve testability and reusability.

Core Features & Use Cases

  • Presentational components render UI from props
  • Container components handle data fetching and pass data down
  • Hooks can replace containers for simpler architectures

Quick Start

Create a presentational component that renders data via props and a container that fetches data and passes it to that component.

Frequently Asked Questions about presentational-container-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate business logic from UI rendering in React?

To separate business logic from UI rendering in React, use the presentational and container pattern. Container components or hooks manage data fetching and pass data as props to presentational components that strictly handle rendering.

What is the presentational and container pattern for React component design?

The presentational and container pattern is a React architecture that decouples data fetching from UI rendering. Presentational components receive data via props to render views, while container components handle the underlying business logic and state management.

How do I use React hooks to replace container components for simpler code?

You can replace container components with React hooks to simplify code architecture. Custom hooks handle the data fetching and business logic, passing the required state and functions directly down to your presentational components for rendering.

Does separating UI from logic improve component testability and reuse?

Separating UI from logic significantly improves component testability and reuse. Presentational components become pure functions of props that are easy to test, while container logic can be validated independently without rendering overhead.

When should I use container components versus hooks for data fetching?

Use container components for complex component trees requiring explicit lifecycle management, and prefer hooks for simpler code architectures. Both approaches enforce clear separation of concerns between data access and presentation rendering.