#Cannot read properties of undefined - API Working | Pagination
27 messages ยท Page 1 of 1 (latest)
first do console log api variable and check what data u are getting
it says "undefined"
it means ur not getting anything from api
or ur not using api correctly
this isn't the first time i use this api
i use this api always like this
it uses strapi
the answer is your not getting anythign from api becuse console log is giving undefined
so issue is at api
or ur not calling perfectly
this is very strange
This is the url:
https://s1.gamewatcher.net/api/games?pagination[page]=
See? the api works
data have empty array thats why its undefined
u have to catch error there
do
{api.data?.map(item => <div key={item.id}>{item.game_name}</div>)}
place a question mark there
after data
and try
alriight, same error
Try question mark after api?.data
great! but now i have no data ๐
If it's working then it's means now issue is fetch fetching
Swr is not fetching data properly try to use normal fetch or axios