project_cryptoverse
project_cryptoverse copied to clipboard
TypeError: Cannot read properties of undefined (reading 'total')
× TypeError: Cannot read properties of undefined (reading 'total') Homepage src/components/Homepage.jsx:23
23 | <Col span={12}><Statistic title="Total Cryptocurrencies" value={globalStats.total} /></Col> That's an erroe in HomePage.jsx
What could be the solution? Even the hosted project doesn't load
The coinranking API is down...status code 503
They are migrating to V2 api. It was planned to be down today. I am trying to use the temporary V2 migration api and it works fine just putting this in the browser: https://api.coinranking.com/v2/migration/coins
But, in my app I am getting this response:
Same issue have solved it?
Yes right now the API is back up and running
On Sat, 13 Nov 2021, 21:50 Mohd Arif Ansari, @.***> wrote:
Same issue have solved it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adrianhajdin/project_cryptoverse/issues/17#issuecomment-968117127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNBKUHOFM4SAFSNV75DU7LUL2XPVANCNFSM5HVNLLLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Still I am getting the same error how to fix it?
I am getting undefined (reading 'total')
Do you have this part? if (isFetching) return "Loading . . .";
yes I have it still getting the same error
I'm having the undefined error as well... there seems to be some kind of API error with RapidAPI and the returned object.
There are several posts on StackOverflow about using the Fetch method but I couldn't get it to work.
Has anyone had any luck getting this to work?
Add a question mark before the total. Something?.total it worked for me!
Add a question mark before the total. Something?.total it worked for me!
Yeah by doing this I am able to see my window but value displayed in front of Total Cryptocurrencies is 0.How to resolve this?
Add a question mark before the total. Something?.total it worked for me!
Yeah by doing this I am able to see my window but value displayed in front of Total Cryptocurrencies is 0.How to resolve this?
I have it working on mine if you want to look at the code here -> https://github.com/ParkerM2/Crypto-Site/blob/main/src/components/HomePage.jsx
- If that doesn't work for you I would make sure you are getting a response from the API, it could be your ENV file isn't set up properly or your API codes from RAPID API aren't returning a response if I had to guess
I think you guys are discussing bout this globalStats.total
.
My opinion:
- check whether the api returned the response properly by doing
console.log(globalStats)