【发布时间】:2016-11-10 12:54:17
【问题描述】:
我想根据 if 语句的结果将内容保存在变量中。但是当我添加多行时它不起作用。
let content = null
if(this.props.group.name != null){
content = <Text>Just this line works</Text>
<Text>This doesn't work</Text>
}
我不知道该怎么做。我不能像在 Javascript 中那样在行尾添加 +。
【问题讨论】:
-
你不能把它加在一起吗?像这样 -
content = <Text>Just this line works</Text> <Text>This doesn't work</Text> -
内容更多时不会。这只是一个例子。
标签: reactjs react-native jsx