hooks

Custom Hook Guidelines

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "hooks" with this command: npx skills add elie222/inbox-zero/elie222-inbox-zero-hooks

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 apps/web/hooks/ directory.

  • Naming: Use the use prefix (e.g., useAccounts.ts ).

  • Data Fetching: For fetching data from API endpoints, prefer using useSWR . Follow the guidelines outlined in data-fetching.mdc.

  • Create dedicated hooks for specific data types (e.g., useAccounts , useLabels ).

  • The hook should typically wrap useSWR , handle the API endpoint URL, and return the data, loading state, error state, and potentially the mutate function from SWR.

  • 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.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ui-components

No summary provided by upstream source.

Repository SourceNeeds Review
General

ux-writing

No summary provided by upstream source.

Repository SourceNeeds Review
General

cursor-rules

No summary provided by upstream source.

Repository SourceNeeds Review