Mod*_*esq 4 javascript arrays reactjs
如果声明工作,我似乎无法得到我的jsx es6反应..我做错了什么?
const otherVariables = doesntMatter;
return (
...
<div>
{if (props.student.length == null && props.teacher.length == null) => (
<p>empty</p>
) : (
<p>not empty</p>
)}
</div>
...
)
Run Code Online (Sandbox Code Playgroud)
如何检查两个阵列是否为空?
有一个语法错误,您正在测试lambda表达式.
你可以做点什么
return !!props.student.length && !!props.teacher.length ? <p>not empty</p> : <p>empty</p>;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19419 次 |
| 最近记录: |