Skip to content

Create TanStack Query hooks for notes #20

@RossCabrera

Description

@RossCabrera

Overview

Create custom React Query (TanStack Query) hooks for notes management with
caching, automatic refetching, and optimistic updates.

Hooks to Create

useNotes()

  • Fetches list of notes
  • Handles pagination
  • Refetches on window focus
  • Caches data
  • Returns: { data, isLoading, error }

useNote(id)

  • Fetches single note by ID
  • Caches individual note
  • Refetches on interval

useCreateNote()

  • Mutation for creating note
  • Returns: { mutate, isPending, error }
  • Invalidates notes list on success

useUpdateNote(id)

  • Mutation for updating note
  • Optimistic update
  • Returns: { mutate, isPending, error }

useDeleteNote(id)

  • Mutation for deleting note
  • Returns: { mutate, isPending, error }
  • Invalidates list on success

Acceptance Criteria

  • Hooks use TanStack Query
  • Data automatically cached
  • Automatic refetching configured
  • Optimistic updates work
  • Error handling works
  • Loading states available
  • Mutations invalidate cache
  • Works with axios interceptors
  • TypeScript support

Related Issues

Metadata

Metadata

Assignees

Labels

TaskGeneral work that doesn’t directly add features or fix bugs (maintenance, updates, setup tasks).frontendUser interface, client-side logic, components, styling, and user interactions.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions