手册目录
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课时 | 18.1万人学习
共49课时 | 82.8万人学习
共29课时 | 65.3万人学习
共25课时 | 41.5万人学习
共43课时 | 77.2万人学习