Cannot read property 'type' of null error in no-array-index-key.js #1242
Closed
Description
opened on Jun 6, 2017
Version 7.0.1
The full stack trace can be found below.
The issue occurs when I begin to add the key to this code:
this.state.array.map((arrayItem, index) => (
<div>
<button onClick={() => this.delete(index)}>Delete this thing</button>
</div>
))
If I begin to enter the key
attribute:
this.state.array.map((arrayItem, index) => (
<div key>
<button onClick={() => this.delete(index)}>Delete this thing</button>
</div>
))
An error in the console is triggered, although I wasn't finished writing the new line.
The issue appears to be on this line, and I suspect it could be corrected altering the line to be if (!value || value.type !== 'JSXExpressionContainer') {
, but I'm not sure about the implication of making that change.
Activity