React × Typescriptで「式が必要です。ts(1109)」のエラーを解消する方法を教えてください。

実現したいこと

Typescriptで入力フォームを作っており、question.methodの値によってラジオボタン、テキストボックスを設置しようとしています。
以下のエラーの解消法が分からないため、どなたかご指摘ください。

発生している問題・エラーメッセージ

return ( <> <FormControl> { if ({question.method} === "text") { <TextField id="standard-basic" label="Standard" variant="standard" /> } else if ({question.method} === "radio") { <RadioGroup defaultValue="1"> <FormControlLabel value=1 control={<Radio />} label="当てはまる" /> <FormControlLabel value=2 control={<Radio />} label="当てはまらない" /> <FormControlLabel value=3 control={<Radio />} label="どちらとも言えない" /> </RadioGroup> } } </FormControl> </> </> )

エラーメッセージ

式が必要です。ts(1109)

該当のソースコード

if ({question.method} === "text") {

コメントを投稿

0 コメント