You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you creating an api slice using createApi method from rtk(specific version for react import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react') it's dose not provide any hook for export from api slice.
##Steps to reproduce:
Clone this repo, add example code from rtk with pockemon api.
// Need to use the React-specific entry point to allow generating React hooks
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import type { Pokemon } from './types'
// Define a service using a base URL and expected endpoints
export const pokemonApi = createApi({
reducerPath: 'pokemonApi',
baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),
endpoints: (builder) => ({
getPokemonByName: builder.query<Pokemon, string>({
query: (name) => `pokemon/${name}`,
}),
}),
})
// Export hooks for usage in function components, which are
// auto-generated based on the defined endpoints
export const { useGetPokemonByNameQuery } = pokemonApi
Try to export useGetPokemonByNameQuery and you will see that it's type is any
As I understood after research, it's because of vite version.
Dose someone know how to fix this?
The text was updated successfully, but these errors were encountered:
###The Problem:
When you creating an api slice using createApi method from rtk(specific version for react
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
) it's dose not provide any hook for export from api slice.##Steps to reproduce:
Clone this repo, add example code from rtk with pockemon api.
Try to export
useGetPokemonByNameQuery
and you will see that it's type isany
As I understood after research, it's because of vite version.
Dose someone know how to fix this?
The text was updated successfully, but these errors were encountered: