Well, you need to get out data._idand make sure they are all unique. Or you can do this:
renderData() {
return this.state.data.map((data, index) => {
return (
<QuestionItem key={index} data={data} delete={this.deleteItem} edit-{this.editItem} />
);
});
}
As another answer pointed out, another one calls map, which goes to the need for rendering to set the character keyto a unique value too.
So these:
renderTags() {
return this.props.data.tag.map((tag) => {
return (
<FlatButton label={tag} />
)
})
}
renderCompany() {
return this.props.data.company.map((company) => {
return (
<FlatButton label={company} />
)
})
}
It should become:
renderTags() {
return this.props.data.tag.map((tag, index) => {
return (
<FlatButton key={index} label={tag} />
);
});
}
renderCompany() {
return this.props.data.company.map((company, index) => {
return (
<FlatButton key={index} label={company} />
);
});
}
, index, . SQL. , ! , key - . key :
- :
key : string | boolean | number | null,
, ( , , , , ), :
renderTags() {
return this.props.data.tag.map((tag) => {
return (
<FlatButton key={tag} label={tag} />
);
});
}
- (tag || '').toLowerCase().replace(' ', '_'), , React - ( ). ! DOM, data-reactid, , ( , 0.15 ). React 0,15.
. . , , , , , ( , React renders). . - . , , , , .