Skip to content
Agentmart
Submit a tool

component-patterns

Component patterns — container/presentational for React/Vue/Angular.

Skill by Dev-Toolbelt

IndexedMIT★ 7
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/dev-toolbelt-component-patterns

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Component patterns — container/presentational for React/Vue/Angular.

Use cases: frontend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/component-patterns

What's inside

Skill name
component-patterns
Description
Component patterns — container/presentational for React/Vue/Angular.
License
MIT
Instructions
176 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Component Patterns

## Container / Presentational (Smart / Dumb)

The core idea: separate **what data comes from** (container) from **how it looks** (presentational). Presentational components receive everything via props/inputs — they own no side effects and no data fetching.

| Aspect | Container (Smart) | Presentational (Dumb) |
|---|---|---|
| Responsibility | Fetch data, manage state, handle business logic | Render UI, emit user events |
| Dependencies | API clients, stores, router | None beyond UI primitives |
| Reusability | Low — tied to a specific domain | High — usable anywhere |
| Testability | Test behavior + integration | Test with prop snapshots / storybook |
| State | Owns or subscribes to state | Receives everything via props/inputs |

**When to split**: as soon as a component both fetches data AND renders UI, extract the rendering into a presentational child. This makes the UI testable without mocking the network.

---

## Rules

- **One reason to change**: if a component would change for a UI tweak AND for an API change, split it.
- **No business logic in templates**: move conditionals, transforms, and computations to hooks, composables, or services — not inline in JSX/template.
- **Props down, events up**: data flows down via props/inputs; user intent flows up via callbacks/emits/outputs.
- **Max ~150 lines per component**: a component that exceeds this is doing too much; split before it grows further.
- **Prop sprawl**: more than 5–7 props is a design smell — consider decomposition or a configuration object.
- **No cross-feature imports**: a component in `features/orders` must not import directly from `features/users`; go through a shared layer.

---

## React

```tsx
// Container — owns data fetching and state
function OrderListContainer() {
  const { data, isLoading, error } = useOrders()
  if (isLoading) return <Spinner />
  if (error) return <ErrorMessage error={error} />
  return <OrderList orders={data} />
}

// Presentational — pure render, fully testable with props alone
function OrderList({ orders }: { orders: Order[] }) {
  return (
    <ul>
      {orders.map(o => <OrderItem key={o.id} order={o} />)}
    </ul>
  )
}
```

**React-specific rules**:
- Custom hooks are the idiomatic container layer — prefer `useOrders()` over class-based containers.
- Wrap page-level components in an `ErrorBoundary`; presentational components should not catch errors themselves.
- Use `React.memo` on stable presentational components to avoid unnecessary re-renders from parent state changes.

---

## Vue

```vue
<!-- Container -->
<script setup lang="ts">
const { orders, isLoading, error } = useOrders()
</script>
<template>
  <Spinner v-if="isLoading" />
  <ErrorMessage v-else-if="error" :error="error" />
  <OrderList v-else :orders="orders" />
</template>

<!-- Presentational -->
<script setup lang="ts">
defineProps<{ orders: Order[] }>()
</script>
<template>
  <ul>
    <OrderItem v-for="o in orders" :key="o.id" :order="o" />
  </ul>
</template>
```

**Vue-specific rules**:
- Composables (`useX`) are the Vue equivalent of React hooks — put all fetching and state logic there.
- Use `defineProps` with explicit types; avoid prop drilling beyond two levels — use `provide`/`inject` or a store.
- Emit events with `defineEmits` and typed payloads; never mutate a prop directly.

---

## Angular

```typescript
// Container — smart component, injects service
@Component({
  selector: 'app-order-list-container',
  template: `
    <app-spinner *ngIf="isLoading" />
    <app-error-message *ngIf="error" [error]="error" />
    <app-order-list *ngIf="!isLoading && !error" [orders]="orders" />
  `
})
export class OrderListContainerComponent implements OnInit {
  orders: Order[] = []
  isLoading = false
  error: Error | null = null

  constructor(private orderService: OrderService) {}

  ngOnInit() {
    this.isLoading = true
    this.orderService.getOrders().subscribe({
      next: orders => { this.orders = orders; this.isLoading = false },
      error: err => { this.error = err; this.isLoading = false }
    })
  }
}

// Presentational — dumb component, only @Input / @Output
@Component({
  selector: 'app-order-list',

From Dev-Toolbelt/dev-team-agents, MIT.

More from Dev-Toolbelt/dev-team-agents

Signals

Stars
7
Forks
0
Open issues
0
Last commit (this folder)
Oct 18, 2026 (10 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Dev-Toolbelt

Cite this page

component-patterns skill. Agent Mart. https://agentmart.dev/skills/dev-toolbelt-component-patterns (last updated 2026-10-24)