【发布时间】:2018-05-20 07:25:09
【问题描述】:
{
this.state.isLoadingInputDropDown &&
<option value="-1" disabled >Loading...</option >
}
{/* TODO : was not able to combine below statements */}
{
!this.state.isLoadingInputDropDown
&& <option value="-1" >--Select a Accessorial Charge first --</option>
}
{
!this.state.isLoadingInputDropDown
&& this.state.allInputs.length > 0
&& this.state.allInputs.map(
(input) => (<option value={input.id} key={input.id}>{input.name}</option>)
)
}
试图使这个 JSX 单线或紧凑的东西。 我尝试了所有可能的(我能想到的)结构
【问题讨论】:
-
为什么要让它更紧凑?