render() {
...
{
dataSource != null : (
<ListView />
) : (
<Components2 />
)
}
...
}
希望是dataSource为空时显示<Components2 />组件,目前是dataSource不为空确实显示<ListView />数据,dataSource为空也不显示<Components2 />,请大家指教
所以问题是如何写对三目运算符的语法?
答案是: