Réponse

Non

Explication

The reason why has to do with the way that JSX is compiled.

What if you want a JSX expression to render, but only under certain circumstances? You can’t inject an if statement.
This code will break:

(
<h1>
{
if (purchase.complete) {
'Thank you for placing an order!'
}
}
</h1>
)

Question

Attention : Est-ce qu'on peut injecter une instruction if dans une expression JSX ?

Thématique