리스트 부분 map 으로 반복문 만들고 그안에 따봉버튼 개별적으로 카운팅 되게
해보려는데 오류가 나서 질문드립니당.
let [따봉, 따봉변경] = useState([0,0,0]); (근데 이렇게 하니깐 페이지에서 따봉옆에 000 이렇게 뜨더라고요)
{
글제목.map(function(a){
return (
<div className='list'>
<h4>{ a } <span onClick={ ()=>{ 따봉.map(function(i){
return i+1;
})} }>👍</span> {따봉}</h4>
<p>2월 18일 발행</p>
<hr/>
</div>
)
})
}
이렇게 작성했는데 콘솔오류가 발생합니다. 콘솔오류는 이렇습니다.
Warning: Each child in a list should have a unique "key" prop.
Check the render method of App
. See https://reactjs.org/link/warning-keys for more information.
at div
at App (http://localhost:3000/static/js/bundle.js:33:69)
key 값을 부여해야 되는거 같은데 어디에 어떤식으로 부여해야 될지 몰라서 질문드립니다.