mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 23:04:59 +08:00
add .mdc file
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
---
|
||||
description: This rule enforces the use of functional components with hooks in React components within the src/components directory.
|
||||
globs: src/components/**/*.tsx
|
||||
---
|
||||
- Always use functional components with hooks instead of class components.
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
---
|
||||
description: This rule enforces the defined folder structure for a React project, improving organization and maintainability.
|
||||
globs: src/**/*
|
||||
---
|
||||
- Enforce the following folder structure:
|
||||
- src/
|
||||
- components/
|
||||
- hooks/
|
||||
- useQueries/
|
||||
- useMutations/
|
||||
- pages/
|
||||
- utils/
|
||||
- api/
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
---
|
||||
description: This rule lists additional instructions for using React Query, including TypeScript usage, error handling, and debugging tools.
|
||||
globs: src/**/*.tsx
|
||||
---
|
||||
- Use TypeScript for type safety with React Query
|
||||
- Implement proper error boundaries for query errors
|
||||
- Utilize React Query DevTools for debugging
|
||||
- Use stale-while-revalidate strategy for data freshness
|
||||
- Implement optimistic updates for mutations
|
||||
- Use query invalidation for data refetching
|
||||
- Follow React Query naming conventions for consistency
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
---
|
||||
description: This rule outlines the general best practices for using React Query throughout the React project.
|
||||
globs: src/**/*.tsx
|
||||
---
|
||||
- Use QueryClient and QueryClientProvider at the root of your app
|
||||
- Implement custom hooks for queries and mutations
|
||||
- Utilize query keys for effective caching
|
||||
- Use prefetching for improved performance
|
||||
- Implement proper error and loading states
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description: This rule specifies the folder structure and purpose for placing React Query custom hooks in dedicated subdirectories.
|
||||
globs: src/hooks/**/*.ts
|
||||
---
|
||||
- Place query hooks in src/hooks/useQueries/
|
||||
- Place mutation hooks in src/hooks/useMutations/
|
||||
Reference in New Issue
Block a user