Bug in React Intermediate course - useGenres() No overload matches this call

There is a bug in the ./src/hooks/useGenres.ts where the compiler flags the ‘queryKey’ with an error that starts with “No overload matches this call”. If this has you confused/disappointed that you cannot figure this out, do not get discouraged! Mosh realized this mistake several exercises later and shows you how to solve it. Go to “32 - Exercise - Creating Lookup Hooks. Minute 3:40” for the solution.

Please note that the same error happens in ‘./src/hooks/usePlatforms.ts’


Is it because we’re not returning the results of the arrow function? I just changed mine to

const useGenres = () => {
return useQuery();

It is because our FectchResponse type does not match the actual structure of the data files so after we added the “next” property for our infinite query for games, it caused an error for genres and platforms because they do not contain the “next” property.

A quick fix I did was to make next optional

export type FetchResponse<T> = {
  count: number;
  next?: string;
  results: T[];

But as usaszerelem says, in a few episodes Mosh will show how to fix it and it is a better way. We actually restructure our data files so they have the correct structure.


This is only a problem if you have added curly braces to your function, in the lesson, there are no curly braces, so the function will use implicit return