replace for loop with forEach
This commit is contained in:
parent
006c78a362
commit
9457d2e57c
1 changed files with 6 additions and 10 deletions
|
@ -7,22 +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 key={i}>
|
<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(
|
||||||
// react wants dom items from an array or
|
// no array index so let's just call it 0
|
||||||
// iterator to have a key property. since this
|
|
||||||
// is the only item we're pushing to the array
|
|
||||||
// and don't have a counter to include,
|
|
||||||
// let's just call it 0.
|
|
||||||
<p tabIndex="0" key={0}> There are no lint messages </p>
|
<p tabIndex="0" key={0}> There are no lint messages </p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue