Open History to see the last commit
1import { queryOptions } from '@tanstack/react-query'
2β
3export const pokemonOptions = queryOptions({
4 queryKey: ['pokemon'],
5 queryFn: async () => {
6 const response = await fetch('https://pokeapi.co/api/v2/pokemon/25')
7 if (!response.ok) throw new Error('Failed to fetch pokemon')
8β
9 return response.json()
10 },
11})