mounted icon indicating copy to clipboard operation
mounted copied to clipboard

建议修改:使用循环的 index 变量作为 key 是一种反优化

Open MoNodin opened this issue 6 years ago • 2 comments

编译小程序时提示: 编译 组件文件 node_modules/mounted/src/components/PickerView/index.tsx 建议修改:使用循环的 index 变量作为 key 是一种反优化。参考:https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md

189 | } 190 | return (<PickerView value={fullSelectedIndexes} className={m-picker-view ${disabled && 'm-picker-view_disabled'} ${className}} style={styles.view} indicatorStyle={height:${styles.indicator.height}} onPickStart={this.props.onPickStart} onPickEnd={this.props.onPickEnd} onChange={this.handleChange}>

191 | {normalizedData.map((colData, colIndex) => (<Block key={colIndex}> | ^^^^^^^^ 192 | <PickerViewColumn key={column-${colIndex}}> 193 | {colData.map((item, itemIndex) => (<View key={itemIndex} className='m-picker-view__item'> 194 | <View className='m-picker-view__item__label'>

MoNodin avatar May 13 '19 03:05 MoNodin

这个不用管哈 不影响

fjc0k avatar May 13 '19 03:05 fjc0k

触发规则:render树进行diff时,没有发生变化的element就不做更改

以下情况可忽略此错误:

  1. 列表不被计算和改变。
  2. 列表项没有ID属性
  3. 列表不会执行重排或筛选操作

参考资料

github65535 avatar Oct 11 '19 02:10 github65535