-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
TypeError: countries.map is not a function #4
Comments
The name of the variable here should be what you have written in useState. According to the video, the name of the state variable is 'fetchedCountries' instead of 'countries', that might be the problem. |
Can you share the entire code snippet? |
@FottyM Brother @kunalkashyap855 is saying that you should write like this |
I managed fix the problem with your support. Thank you! |
Hello guys, taking advantage of the fact that it's still open, I'm having a similar problem: TypeError: fetchedCountries.map is not a function
Below is how my code is : |
Edit: const countries = await fetchCountries()
setFetchedCountries(countries)
// or
setFetchedCountries(await fetchCountries()) |
That's it! Now it worked... Thanks @FottyM 💯 👍 |
First of all let me thank you, for sharing this valuable knowledge
I coded along with you and everything went well for the first couple of minutes. However in the end I´m getting the following error:
TypeError: countries.map is not a function
19 | return (
20 |
21 | <NativeSelect defaultValue="" onChange={(e) => handleCountrychange(e.target.value)}>
The text was updated successfully, but these errors were encountered: