Overview
- Skill Key
- eaveluo/building-components
- Author
- eaveluo
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/eaveluo/building-components
- Latest Commit SHA
- 4c178a84384dcf45c622fc9f932bdb0102f4b46c
React component building and composition best practices. Use when creating, reviewing, or refactoring React components. Covers component structure, props patterns, composition techniques, and reusability guidelines.
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 building-components 技能。 若已安装,则直接安装 building-components 技能。
# Building React Components
Best practices for building reusable, maintainable React components.
## When to Apply
Reference these guidelines when:
- Creating new React components
- Reviewing component structure and API design
- Refactoring components for better reusability
- Implementing component composition patterns
- Designing props interfaces
## Core Principles
### 1. Single Responsibility
Each component should do one thing well. Split large components into smaller, focused pieces.
### 2. Composition Over Inheritance
Prefer composing components together rather than complex inheritance hierarchies.
```jsx
// ✅ Good: Composition
function Page() {
return (
<Layout>
<Header />
<Main>
<Article />
</Main>
<Footer />
</Layout>
);
}
// ❌ Avoid: Deep nesting
function Page() {
return <LayoutWithHeaderAndFooter><MainContent /></LayoutWithHeaderAndFooter>;
}
```
### 3. Props Design
- Use TypeScript for props typing
- Keep props interfaces simple and focused
- Prefer many small props over few large objects
- Use children prop for content composition
### 4. Component Structure
```tsx
// ✅ Recommended structure
import { FC } from 'react';
interface Props {
title: string;
children?: React.ReactNode;
}
export const Card: FC<Props> = ({ title, children }) => {
return (
<div className="card">
<h2>{title}</h2>
{children}
</div>
);
};
```
### 5. State Management
- Keep state as close to where it's used as possible
- Lift state up only when necessary
- Consider custom hooks for reusable state logic
## Common Patterns
### Compound Components
For flexible APIs like Select/Option, Tabs/TabList/Tab/TabPanel.
### Render Props
For sharing behavior while keeping rendering control.
### Hooks
For sharing stateful logic across components.
## Related Skills
- vercel-react-best-practices
- next-best-practices
- vercel-composition-patterns
capt-marbles
Task Router
capncoconut
Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay, check marketplace stats, or manage agent credentials. Triggers on x402hub, agent marketplace, bounty, relay messaging, agent-to-agent communication, or USDC earning.
capevace
Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.
captchasco
OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.
carol-gutianle
name: modelready description: Start using a local or Hugging Face model instantly, directly from chat. metadata: {"openclaw":{"requires":{"bins": "bash", "curl" }, "env": "URL" }}
canbirlik
Controls Wiz smart bulbs (turn on/off, RGB colors, disco mode) via local WiFi.