Getting key prop warning in React, even though key is set

前端 未结 5 1326
死守一世寂寞
死守一世寂寞 2021-01-07 16:29

Problem

I\'m getting this warning:

Warning: Each child in an array or iterator should have a unique \"key\" prop. Check the render method of

5条回答
  •  攒了一身酷
    2021-01-07 17:25

    I had the problems too, and fixed it after follwing link.

    like:

    {_data.map(function(object, i){
         return 
    {[ object.name , {object.city} , // remove the key object.age ]}
    ; })}

提交回复
热议问题