i don't know why react keep asking for the key even when the key is added.
i have a component that render some posts but each posts is rendered in it's own component and it's inside a component that come from Swiper
my component look like this:
export default function Posts() {
const postsCards = posts.map(post => {
return <SwiperSlide className="w-25" key={post._id}>
<PostCard post={post} key={post._id}/>
</SwiperSlide>
})
return (
<div className="container">
<h4>Top posts</h4>
<Swiper
slidesPerView= 'auto'
spaceBetween= {10}
observer= {true}
observeParents={true}
>
{postsCards}
</Swiper>
</div>
)
}
This is not exactly a solution, but using the index as a key for now, allows you to identify whether your post._id is unique.
If it's no longer returning error with the above codes, then it's likely you have duplicated
posts
in your posts array.