React框架开发问题总结
发布时间:2020-12-15 08:19:26 所属栏目:百科 来源:网络整理
导读:react-dom.js:18962Warning:Unknownprop`col`ontdtag.Removethispropfromtheelement.Fordetails,see https://fb.me/react-unknown-prop intd(createdbyListComponent) intr(createdbyListComponent) intable(createdbyListComponent) indiv(createdbyListCom
react-dom.js:18962Warning:Unknownprop`col`on<td>tag.Removethispropfromtheelement.Fordetails,see
https://fb.me/react-unknown-prop
intd(createdbyListComponent)
intr(createdbyListComponent)
intable(createdbyListComponent)
indiv(createdbyListComponent)
inListComponent
indiv
解决办法:把col改成colSpan
<tdcolSpan='6'>/td>
react-dom.js:18962Warning:validateDOMNesting(...):<tr>cannotappearasachildof<table>.SeeListComponent>table>tr.Adda<tbody>toyourcodetomatchtheDOMtreegeneratedbythebrowser.
解决办法:<table>加增加子元素<tbody>
react-dom.js:18698UncaughtInvariantViolation:ExpectedonClicklistenertobeafunction,insteadgottypestring
解决办法:
预计OnClick侦听是一个函数,而不是字符串类型了
<spanclassName="first"onClick="{this.handleFirst}">首页</span>
改成
<spanclassName="first"onClick={this.handleFirst}>首页</span>
react.js:3801Warning:Eachchildinanarrayoriteratorshouldhaveaunique"key"prop.Checktherendermethodof`ListComponent`.See
https://fb.me/react-warning-keysformoreinformation.
intr(createdbyListComponent)
inListComponent
indiv
解决办法:在循环array或iterator时,要给循环的标签增加一个key值。
[0,1].map((child,i)=>{
return(
<trkey={i}>
<td>item.time</td>
</tr>
);
})
react-dom.js:18698UncaughtInvariantViolation:noData.render():AvalidReactelement(ornull)mustbereturned.Youmayhavereturnedundefined,anarrayorsomeotherinvalidobject.
翻译:
return里面的元素不完整 可能返回了undefined或数组或其他非法对象
render:function(){
lettext;
if(this.props.isShow){
text=(<divclassName="c999f16">{this.props.text}</div>);
}
console.log(text);
return({text});
}
解决办法:返回值应该包裹在一个元素内
return(<div>{text}</div>);
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 快速崩溃的最简单方法是什么?
- swift – Codable / Decodable应该使用字符串解码数组
- 由React Router引起的组件重复渲染谈Route的使用姿势
- FTPClientHelper辅助类 实现文件上传,目录操作,下载等操作
- ruby-on-rails – 如何在Rails中的date_select中使用空白和
- FlashBuilder4安装SVN插件步骤
- cocos2d-x中几种存储数据的方式
- 跨域问题——easyXDM以及JSONP
- cJson --svn:cjson.svn.sourceforge.net/svnroot/c...
- FLASH位宽为8、16、32时,CPU与外设之间地址线的连接方法