Files
nuzlocke-tracker/frontend/src/hooks/usePokemon.ts
Julian Tabel 7c65775c8b Add frontend API client and TanStack Query hooks
Install @tanstack/react-query, create a fetch-based API client with typed
functions for all endpoints, and add query/mutation hooks for games, pokemon,
runs, and encounters. Includes Vite dev proxy for /api and QueryClientProvider
setup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 15:09:14 +01:00

11 lines
262 B
TypeScript

import { useQuery } from '@tanstack/react-query'
import { getPokemon } from '../api/pokemon'
export function usePokemon(id: number | null) {
return useQuery({
queryKey: ['pokemon', id],
queryFn: () => getPokemon(id!),
enabled: id !== null,
})
}