safak / next-blog

316 stars 318 forks source link

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

Open profabhishekjha opened 1 year ago

profabhishekjha commented 1 year ago

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 commented 1 year ago

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

profabhishekjha commented 1 year ago

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

satyamgit1 commented 7 months ago

hi bro have you find the solution

profabhishekjha commented 7 months ago

This never had a problem

On Fri, 9 Feb, 2024, 2:30 pm Satyam singh, @.***> wrote:

hi bro have you find the solution

— Reply to this email directly, view it on GitHub https://github.com/safak/next-blog/issues/10#issuecomment-1935553864, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM35FOQNASGBCIGG54HHLALYSXQUJAVCNFSM6AAAAAA4YU7NUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVGU2TGOBWGQ . You are receiving this because you were mentioned.Message ID: @.***>

satyamgit1 commented 7 months ago

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

AdakHaddad commented 5 months ago

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 && ( <Image src={item.img} alt="" width={32} height={32} className={styles.image} /> )} {item.title} ))}

`

satyamgit1 commented 4 months ago

thanks