REACT Missing “key” prop for element
https://stackoverflow.com/questions/48266018/missing-key-prop-for-element-reactjs-and-typescript
When rendering an array of elements, React needs a key
prop (1) to identify elements and optimize things.
Add key={topic.id}
to your element in jsx:
return (<div>
<h2>Results List</h2>
{topics.map((topic: any) =>
<div className="panel panel-default" key={topic.id}>
<div className="panel-heading">{topic.name}</div>
<div className="panel-body">{topic.description}</div>
</div>
)}
</div>
);
以上是 REACT Missing “key” prop for element 的全部内容, 来源链接: utcz.com/z/382033.html