Hello Everyone, I need help on the GameGrid and useGames section, it would be great if you could help me out

on the GameGrid component, there have problem with the results
const fetchGameCount =
data?.pages.reduce((total, page) => total + page.results.length, 0) || 0;

in the results it’s showing “Property ‘results’ does not exist on type ‘TQueryFnData’”
I have tried multiple ways but not been solved yet.

go check out my source code on github, I followed mosh with only a few changes on the time.

Thanks for your kind reply, I have done the same thing as you did in your code but useGames hook showed the error
You can look into this repo

not gotten any solution yet.

Oh i did forget to mention at some point he goes back and refactors so depending on which part of the tutorial your at, you may not be implementing the same code yet

Thanks for the reply, Yeah then I can move forward and then will get this solution.

For me 9/10 times i make a type somewhere like a cap or underscore, depending on what the error is it may be an easy fix, try to paste your code in chat gpt and checking the error code on VScode. Remember that troubleshooting is a part of coding as well. I do remember 1 or 2 issues he resolves in a later video. Although if your find with moving on you can always pull my project from git later if there is too many problems, just remember use your own api key lol.

Yeah, there is still a problem with the typescript error but I am moving forward with this, hope it will be good in the upcoming code.

I think as I use all of the latest packages so there was some problem with the typescript in the scroll to load more system. That still not resolved.

You can post the updated code and i’ll take a look, also try to put the code into chatgpt and it should find common errors.

I have already tried with chatGPT but seems like it’s not a common error, when I tried to build it then it showed the error. you can watch my code here.

which file is causing the error?

also you could try npm audit in the console that may find bugs sometimes

Thanks for your kind reply, Actually I am having problem in the useGames hooks when I am trying to build, it’s working good but when I trying to build then it’s showing the following error:

looks like you refrenced gameQuery instead of GameQuery which i think is the Props
const gameQuery = useGameQueryStore( s => s.GameQuery) //capital G
const gameQuery = useGameQueryStore(s => s.gameQuery); //error

It’s honestly a confusing thing having so many similar components, but remember if your creating a function when it refers to itself instead of an outside prop, it won’t bring the utility from another function.

Thanks for your kind reply, I solved this by using initialPageParam in useInfiniteQuery, In the course initialPageParam was not required as the reactQuery was version 4 but in version 5 the initialPageParam is required.

1 Like