Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhandled Rejection (TypeError): Cannot read property 'length' of undefined #23

Open
MERCERNYC opened this issue Oct 8, 2020 · 3 comments

Comments

@MERCERNYC
Copy link

After working on fetchDailyData I am getting this error.
Screen Shot 2020-10-08 at 8 59 27 AM
React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
in Chart (at App.js:24)
in div (at App.js:22)
in App (at src/index.js:6)

@shaikhreza43
Copy link

Bro. I have the same issue. This is because the api/daily is not working and it's not returning any response. So you are getting that length error. You can check in the network tab of the developer console. There is nothing wrong in our code

@shaikhreza43
Copy link

Bro, Use this in your Api.js

export const fetchDailyData = async () => {
try {
const { data } = await axios.get(https://api.covidtracking.com/v1/us/daily.json);
const modifiedData = data.map((dailydata) => ({
confirmed: dailydata.positive,
deaths: dailydata.death,
date: dailydata.date
}))

    return modifiedData;
}
catch (error) {
    console.log(error);
}

}

For Fetching Daily Data of United States use this api
https://api.covidtracking.com/v1/us/daily.json

@zpreston123
Copy link

zpreston123 commented Oct 16, 2020

Issue has been resolved in the mathdroid API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants