I want to create a function to create a text if the property description field is empty I have following code in react, however this property description value is coming from an API
React Code
{property.title &&
<p className="descmob left-align">{property.title}</p>
}
The example I want to do would be something like this, but in React.
if(title == null){
console.log('Imóvel sem descrição');
} else {
// AQUI PUXA O TITULO DA API
console.log(.title);
}
Following is an image of how cards are getting
Isolvedthequestionwiththefollowingcode
{<pclassName="descmob left-align">{property.title ? property.title :
'Imóvel sem descrição' }</p>}