-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
Encountered two children with the same key 에러
20.12.21 03:25 작성 조회수 7.35k
0
pages > index.js 에서 PostCard key값을 post.id로 주고 회원가입 창으로 이동하면 Encountered two children with the same key 에러가 발생합니다. 그런데 index로 값을 주면 또 에러가 안나네요...?ㅜㅜㅜㅜ
index는 사용하면 안되는걸로 알고 있어서 key값을 post.id + post.content로 줬는데도 에러가 발생합니다.
index값으로 키값을 줘도 괜찮나요?
<AppLayout>
{me && <PostForm />}
{mainPosts.map((post, index) => (
<PostCard key={index} post={post} />
))}
</AppLayout>
답변을 작성해보세요.
답변 2