NPX Install
npx skill4agent add elie222/inbox-zero hooksTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Custom Hook Guidelines
This rule outlines the guidelines for creating custom React hooks within this project.
Custom Hooks
- Purpose: Encapsulate reusable stateful logic, especially for data fetching or complex UI interactions.
- Location: Place custom hooks in the directory.
apps/web/hooks/ - Naming: Use the prefix (e.g.,
use).useAccounts.ts - Data Fetching: For fetching data from API endpoints, prefer using . Follow the guidelines outlined in data-fetching.mdc.
useSWR- Create dedicated hooks for specific data types (e.g., ,
useAccounts).useLabels - The hook should typically wrap , handle the API endpoint URL, and return the data, loading state, error state, and potentially the
useSWRfunction from SWR.mutate
- Create dedicated hooks for specific data types (e.g.,
- Simplicity: Keep hooks focused on a single responsibility.
By adhering to these guidelines, we ensure a consistent approach to reusable logic and data fetching throughout the application.