React Tutorials
React ES6
React Hooks
A ternary operator is a conditional operator that is simplified such as if / more.
Syntax: condition? <expression if true>: <expression if false>
Here is an example that uses if / else
:
if (authenticated) {
renderApp();
} else {
renderLogin();
}
Here is a similar example using a ternary operator:
authenticated ? renderApp() : renderLogin();