React Component Architecture

React Component Architecture

Guides a coding agent to build scalable React components with hooks, composition, render props, higher-order components and TypeScript.

Skill files7 files

references/

templates/

SKILL.md90 lines
1
---
2
name: react-component-architecture
3
description: >
4
Design scalable React components using functional components, hooks,
5
composition patterns, and TypeScript. Use when building reusable component
6
libraries and maintainable UI systems.
7
---
8
9
# React Component Architecture
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Build scalable, maintainable React components using modern patterns including functional components, hooks, composition, and TypeScript for type safety.
22
23
## When to Use
24
25
- Component library design
26
- Large-scale React applications
27
- Reusable UI patterns
28
- Custom hooks development
29
- Performance optimization
30
31
## Quick Start
32
33
Minimal working example:
34
35
```typescript
36
// Button.tsx
37
import React, { useState, useCallback } from 'react';
38
39
interface ButtonProps {
40
variant?: 'primary' | 'secondary' | 'danger';
41
size?: 'sm' | 'md' | 'lg';
42
disabled?: boolean;
43
onClick?: () => void;
44
children: React.ReactNode;
45
}
46
47
export const Button: React.FC<ButtonProps> = ({
48
variant = 'primary',
49
size = 'md',
50
disabled = false,
51
onClick,
52
children
53
}) => {
54
const variantStyles = {
55
primary: 'bg-blue-500 hover:bg-blue-600',
56
secondary: 'bg-gray-500 hover:bg-gray-600',
57
danger: 'bg-red-500 hover:bg-red-600'
58
};
59
60
const sizeStyles = {
61
// ... (see reference guides for full implementation)
62
```
63
64
## Reference Guides
65
66
Detailed implementations in the `references/` directory:
67
68
| Guide | Contents |
69
|---|---|
70
| [Functional Component with Hooks](references/functional-component-with-hooks.md) | Functional Component with Hooks |
71
| [Custom Hooks Pattern](references/custom-hooks-pattern.md) | Custom Hooks Pattern |
72
| [Composition Pattern](references/composition-pattern.md) | Composition Pattern |
73
| [Higher-Order Component (HOC)](references/higher-order-component-hoc.md) | Higher-Order Component (HOC) |
74
| [Render Props Pattern](references/render-props-pattern.md) | Render Props Pattern |
75
76
## Best Practices
77
78
### ✅ DO
79
80
- Follow established patterns and conventions
81
- Write clean, maintainable code
82
- Add appropriate documentation
83
- Test thoroughly before deploying
84
85
### ❌ DON'T
86
87
- Skip testing or validation
88
- Ignore error handling
89
- Hard-code configuration values
90

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…