[英]Props is missing from props validation
I'm using the following code which is being parsed by the linter eslint-plugin-react. 我正在使用以下代码,它由linter eslint-plugin-react解析。 It returns the warning:
它返回警告:
"product is missing in props validation"
“道具验证中缺少产品”
while i declare product in propTypes at the bottom and that i pass it to function. 而我在底部的propTypes中声明产品 ,并将其传递给函数。 any idea ?
任何的想法 ?
import React from 'react'
const ProductDesc = (props)=>({
render(){
return (
<div>
<h1>{props.product.headline}</h1>
<img src={props.product.images[0].imagesUrls.entry[2].url} alt="Thumbnail large pic"/>
<p>Yeah</p>
</div>
)
}
})
ProductDesc.propTypes = {
product: React.PropTypes.object
};
export default ProductDesc;
syntax should have been 语法应该是
const ProductDesc = (props)=>{
return (
<div>
<h1>{props.product.headline}</h1>
<p>Yeah</p>
</div>
)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.