I'm using the following code which is being parsed by the 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. 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>
)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.