I am wondering how I can add a console.log with in
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}`,
}),
}),
})
So that when a component calls getPokemonByName, it should console.log('Hello I am here!')
I have tried below but does not work and has compile error..
getPokemonByName: builder.query<Pokemon, string>({
query: (name) => {`pokemon/${name}`, **console.log('Hello I am here!')**}
}),
There are no examples of this on https://redux-toolkit.js.org/rtk-query/api/createApi
I want to do this because my component is trying to call this method but I am not sure whether it even gets here!