Warning: Encountered two children with the same key, 2
. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
더미데이터로 게시물을 계속 등록할때 id:2로 지정해놔서 반복문이 인식을 못하는 에러이다.
더미데이터로 프론트를 구현하다보면 이와같이 id가 겹치는 현상이 발생된다.
이럴떄 유용한게 shortid와 faker 이다.
npm i shortid
id:2, ==> id: shortId.generate(),
npm i @faker-js/faker
Array(28).fill().map(() => ({
id : shortId.generate(),
nickname : faker.person.firstName(),
}))