React this.props undefined or empty object (check if prop is empty )

Spread the love

React this.props undefined or empty object (check if prop is empty )

Example code : 
render() {
let Component;
if(check if props has val) {
Component = <Component />
}else {

Component = null
}
return (
<div>
{Component}
</div>
)
}

admin

admin

Leave a Reply

Your email address will not be published. Required fields are marked *