Vérification nul Vérification dans React JS
//if can't be used in jsx file under div hence use ternary operator ?:
// also it needs to be in {}
// typeof is optional
render(){
return(
<div>
{
(typeof x !=='undefined' && typeof x.item !=='undefined')?
<div>success</div>:
<div>fail</div>
</div>
}
)
}
Gorgeous Gannet