Debug React component issues including TypeScript types, props, state management, hooks, and rendering problems...
Analyzes and debugs React/TypeScript component issues in this project.
frontend/src/components/frontend/src/pages/frontend/src/types/frontend/src/services/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'] });
}
});
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
# Run TypeScript check
cd frontend && npx tsc --noEmit
# Check specific file
npx tsc --noEmit src/components/MyComponent.tsx