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

Error: data?.map is not a function #10

Open
profabhishekjha opened this issue Sep 14, 2023 · 7 comments
Open

Error: data?.map is not a function #10

profabhishekjha opened this issue Sep 14, 2023 · 7 comments

Comments

@profabhishekjha
Copy link

src\components\categoryList\CategoryList.jsx (24:15) @ map

22 |

Popular Categories


23 |

24 | {data?.map((item) => (
| ^
25 | <Link
26 | href="/blog?cat=style"
27 | className={${styles.category} ${styles[item.slug]}}

@karshdev
Copy link

@profabhishekjha data is not fetched properly check your routes in api and check wether data is fetched.

@profabhishekjha
Copy link
Author

I have fixed this bug, bro can you guide to do the apis for editors choice and popular categories ?

@satyamgit1
Copy link

hi bro have you find the solution

@profabhishekjha
Copy link
Author

profabhishekjha commented Feb 9, 2024 via email

@satyamgit1
Copy link

can you help me to run this project on my local server

@AdakHaddad
Copy link

AdakHaddad commented May 2, 2024

I solved using Array.array in file
{Array.isArray(data) && data.map((item) => ( <Link href={/blog?cat=${item.slug}} className={${styles.category} ${styles[item.slug]}`}
key={item._id}
>
{item.img && (

)}
{item.title}

))}

`

@satyamgit1
Copy link

thanks

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

4 participants