Warning: Each child in an array or iterator should have a unique "key" prop.
来源:互联网 发布:数据分析入门书籍 编辑:程序博客网 时间:2024/05/16 03:34
源代码是这样
class Main extends Component{ render(){ return( <div> { arr.map((item,index)=>{ return( <li>{item*2}</li> ) }) } </div> ) }}render( <Main />, document.getElementById("root"));
但会报这样的错误:
bundle.js:1004 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `Main`. See https://fb.me/react-warning-keys for more information.
解决方案如下:
class Main extends Component{ render(){ return( <div> { arr.map((item,index)=>{ return( <li key={index}>{item*2}</li> ) }) } </div> ) }}render( <Main />, document.getElementById("root"));
阅读全文
0 0
- Warning: Each child in an array or iterator should have a unique "key" prop.
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render ...
- react Warning: Each child in an array or iterator should have a unique "key" prop. Check the render
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render ...
- react-native中debug报错信息:Each child in an array or iterator should have a unique "key" prop.
- React总结7:Each child in an array or iterator should have a unique "key" prop.的处理方法
- ReactNativeiOS(三)开发零碎3 warning: Each child in ar array or integrator should have a unique "key" prop
- ant-design Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an un
- Must specify unique android:id, android:tag, or have a parent with an id for XXX
- Shuffle an Array or a List - Algorithm in Java
- Each module has to have a unique path
- There's an iterator stored in with each hash
- Have a first child
- Should new index columns be in the key, or included?
- Should I Use a Property or an Instance Variable?
- Different cells on each row in an NSTableView or NSOutlineView
- Ruby: Count unique elements and their occurences in an array
- IntelliSense: PCH warning: header stop cannot be in a macro or #if block. An intellisense PCH file
- 山东省第八届ACM省赛A.Return of the Nim
- JNDI
- Sql中DDL、DML、DCL介绍
- android版本号
- spring_SSH整合之_架构的历史(架构整合JSP+Hibernate+Spring+Struts2+DTO)_9
- Warning: Each child in an array or iterator should have a unique "key" prop.
- Linux设置有效的防火墙策略禁止所有非法的请求
- ARM Linux中断机制之中断处理
- 搭建Linux服务器下网站
- LitePal的使用
- Python二分查找算法
- 策略模式
- BZOJ 2002 [Hnoi2010]Bounce 弹飞绵羊 LCT
- 单例设计模式