手册目录
React教程
三元运算符是一个简化的条件运算符,如 if / else。
语法: condition ? <expression if true> : <expression if false>
这里是一个使用 if / else 的例子:
if (authenticated) {
renderApp();
} else {
renderLogin();
}
这是使用三元运算符的相同示例:
authenticated ? renderApp() : renderLogin();
相关视频
科技资讯
24小时阅读榜
1
2
3
4
5
6
7
8
9
10
精品课程
共5课时 | 17.4万人学习
共49课时 | 78.2万人学习
共29课时 | 62.5万人学习
共25课时 | 39.7万人学习
共43课时 | 73.8万人学习