正解は{condition ? <Component /> : null}または{condition && <Component />}です。JSXの中ではJavaScriptの式のみ使用可能で、if文は使えません。三項演算子や&&演算子で条件分岐を行います。{if (condition)}やwhen...thenはJSXで無効な構文です。