Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

queries.ts

11 lines330 Bytes

1import { queryOptions } from '@tanstack/react-query'
2import { pokemonsAPI } from './api'
3​
4export const pokemonsQueries = {
5 all: () => ['pokemons'] as const,
6 detail: (id: number) =>
7 queryOptions({
8 queryKey: [...pokemonsQueries.all(), 'detail', id] as const,
9 queryFn: () => pokemonsAPI.getPokemon(id),
10 }),