Reactjs jsx中的嵌套条件呈现
我试图在jsx本身中有一个嵌套的if条件。以下是我的代码示例:Reactjs jsx中的嵌套条件呈现,reactjs,Reactjs,我试图在jsx本身中有一个嵌套的if条件。以下是我的代码示例: {this.props.customerInformation? <Descriptions title="Customer Information" bordered> {this.props.customerInformation.customer_status.label}</Descriptions.Item> <
{this.props.customerInformation?
<Descriptions title="Customer Information" bordered>
{this.props.customerInformation.customer_status.label}</Descriptions.Item>
</Descriptions>
:
<Button> Create a new customer </Button>
}
{this.props.customerInformation?
{this.props.customerInformation.customer_status.label}
:
创建新客户
}
我试图做的是在顶部条件中添加另一个条件,看起来像这样:
{this.props.customerInformation?
<Descriptions title="Customer Information" bordered>
<Descriptions.Item>
{this.props.customerInformation.customer_status.label}
</Descriptions.Item>
<Description.Item>
{this.props.customerInformation.poc?
<Descriptions title="poc" >
{this.props.customerInformation.poc}
<Descriptions.Item>
</Descriptions>
:
<Button> Create a new customer </Button>
}
{this.props.customerInformation?
{this.props.customerInformation.customer_status.label}
{this.props.customerInformation.poc?
{this.props.customerInformation.poc}
:
创建新客户
}
添加括号来包装代码
{this.props.customerInformation?
(<Descriptions title="Customer Information" bordered>
{this.props.customerInformation.customer_status.label}
</Descriptions.Item>
</Descriptions>)
:
(<Button> Create a new customer </Button>)
}
{this.props.customerInformation?
(
{this.props.customerInformation.customer_status.label}
)
:
(创建新客户)
}
添加括号来包装代码
{this.props.customerInformation?
(<Descriptions title="Customer Information" bordered>
{this.props.customerInformation.customer_status.label}
</Descriptions.Item>
</Descriptions>)
:
(<Button> Create a new customer </Button>)
}
{this.props.customerInformation?
(
{this.props.customerInformation.customer_status.label}
)
:
(创建新客户)
}