Merge pull request #63 from omnikrll/editor-accessibility-unique-key-warning

add key property to lint message elements
This commit is contained in:
Cassie Tarakajian 2016-08-27 15:05:40 -04:00 committed by GitHub
commit 563617d4e8

View file

@ -7,18 +7,18 @@ class EditorAccessibility extends React.Component {
render() { render() {
let messages = []; let messages = [];
if (this.props.lintMessages.length > 0) { if (this.props.lintMessages.length > 0) {
for (let i = 0; i < this.props.lintMessages.length; i++) { this.props.lintMessages.forEach((lintMessage, i) => {
messages.push( messages.push(
<li> <li key={i}>
{this.props.lintMessages[i].severity} in line {lintMessage.severity} in line
{this.props.lintMessages[i].line} : {lintMessage.line} :
{this.props.lintMessages[i].message} {lintMessage.message}
</li> </li>
); );
} });
} else { } else {
messages.push( messages.push(
<p tabIndex="0"> There are no lint messages </p> <li tabIndex="0" key={0}> There are no lint messages </li>
); );
} }
return ( return (