AGENT SKILL
react
Frontend component library.
- License 许可
- MIT
- 所属仓库
- dhaupin/vant
- 最近更新
- 2026-11-13
- Stars
- ★ 16
- Forks
- 1
01 前言 Front Matter
- name
- react
- license
- MIT
- metadata
- { "author": "vant", "version": "1.0" }
- description
- Frontend component library.
03 SKILL.md 正文
React
Frontend component library.
When To Use
- DOM components
- SPA framework
- Component-based UI
What To Do
1. Component Pattern
function MyComponent({ prop }) {
const [state, setState] = useState(null)
useEffect(() => {
// side effects
}, [])
return <div>{prop}</div>
}
2. Common Hooks
| Hook | What |
|---|---|
| useState | Local state |
| useEffect | Side effects |
| useContext | Shared state |
| useRef | DOM reference |
| useMemo | Memorized value |
| useCallback | Memorized function |
3. Patterns
// Conditional
{condition && <Component />}
// List
items.map(item => <Item key={item.id} {...item} />)
// Form
<form onSubmit={handleSubmit}>
<input value={value} onChange={e => setValue(e.target.value)} />
</form>
4. Testing
render(<MyComponent prop="value" />)
expect(screen.getByText('value')).toBeInTheDocument()
Output
## React
| Component | Tested | Status |
|------------|--------|--------|
| [name] | [YES/NO] | [OK] |
### Props Interface
- [list]
Role: React Developer Input: Components Output: Working UI
Component-based UI.
04 同仓库更多 Skills
yaml
Data serialization.
★ 16
vite
Frontend build tool.
★ 16
typescript
Typed JavaScript.
★ 16
test-unit
Test individual functions and methods in isolation. Test happy path, edge cases, and error handling. Use when adding new functions, after bug fixes, or before commits.
★ 16
test-snapshot
Capture and compare UI/component snapshots to detect visual changes. Use when testing UI rendering, before visual changes, or for design systems.
★ 16
test-smoke
Quick sanity check to verify basic functionality works. Run fastest tests first. Use when needing quick verification before deeper testing.
★ 16