React Cursor Rules
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
- Components should have single responsibility; split when exceeding ~150 lines - Use React Query or SWR for async state; avoid useEffect for data fetching - Memoize with useMemo for expensive computations; useCallback for stable callbacks - Colocate state as close to where it is used as possible - Prefer controlled components with explicit state over uncontrolled refs - Use compound components pattern for complex UI with shared state - Extract custom hooks to share stateful logic across components - Use React.lazy and Suspense for code-splitting heavy components
How to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
Related Rules
Python Cursor Rules
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
TypeScript Cursor Rules
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
Next.js Cursor Rules
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.
Rust Cursor Rules
Cursor rules for Rust: ownership patterns, error handling with Result, idiomatic Rust, and performance-aware coding conventions.