react-component-analyzer
3
总安装量
3
周安装量
#62309
全站排名
安装命令
npx skills add https://github.com/allthriveai/allthriveai --skill react-component-analyzer
Agent 安装分布
mcpjam
3
antigravity
3
replit
3
junie
3
windsurf
3
zencoder
3
Skill 文档
React Component Analyzer
Analyzes and debugs React/TypeScript component issues in this project.
Project Context
- Frontend: React 18 with TypeScript
- Build tool: Vite
- State management: React Query (TanStack Query)
- Routing: React Router v6
- Styling: Tailwind CSS
- Components:
frontend/src/components/ - Pages:
frontend/src/pages/ - Types:
frontend/src/types/ - Services:
frontend/src/services/
When to Use
- “Component not rendering”
- “Props not being passed”
- “State not updating”
- “useEffect not firing”
- “TypeScript error on component”
- “React Query not fetching”
- “Infinite re-renders”
Debugging Approach
1. Component Structure
- Check component file exists and exports correctly
- Verify import paths are correct
- Check for TypeScript errors in props interface
2. Props and Types
- Verify prop types match between parent and child
- Check for optional vs required props
- Look for type mismatches with API responses
3. State and Hooks
- Check useState/useReducer initial values
- Verify useEffect dependencies
- Look for missing dependencies causing stale closures
- Check useMemo/useCallback usage
4. React Query Issues
- Verify query keys are correct
- Check enabled/refetch conditions
- Look for stale time and cache settings
- Verify mutation invalidations
Common Issues
Component not rendering:
// Check: Is it exported correctly?
export default ComponentName; // or
export { ComponentName };
// Check: Is the route configured?
<Route path="/page" element={<ComponentName />} />
Props type mismatch:
// Check: Does interface match API response?
interface Project {
id: number;
title: string; // API might return 'name' not 'title'
}
useEffect not firing:
// Check: Dependencies array
useEffect(() => {
// This only runs when `id` changes
}, [id]); // Missing dependency?
React Query stale data:
// Check: Query invalidation after mutation
const mutation = useMutation({
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['projects'] });
}
});
Key Files to Check
frontend/src/
âââ components/
â âââ common/ # Shared components
â âââ projects/ # Project-specific components
â âââ ui/ # UI primitives
âââ pages/
â âââ ExplorePage.tsx # Explore/discovery page
â âââ ProjectPage.tsx # Single project view
â âââ DashboardPage.tsx
âââ types/
â âââ models.ts # Data model types
â âââ api.ts # API response types
âââ services/
â âââ api.ts # Axios instance
â âââ projects.ts # Project API calls
âââ hooks/
âââ useProjects.ts # Custom hooks
Type Checking Tips
# Run TypeScript check
cd frontend && npx tsc --noEmit
# Check specific file
npx tsc --noEmit src/components/MyComponent.tsx
Browser DevTools
- React DevTools: Inspect component tree, props, state
- Network tab: Verify API requests/responses
- Console: Check for React warnings/errors