Predict Ternary Rendering
Predict Output Easy
Question
What renders in the browser?
Code
const isLoggedIn = false;
const element = (
<div>
{isLoggedIn ? "Welcome back!" : "Please log in."}
</div>
);
Hint
isLoggedIn is false, so the ternary returns the second option.
Explanation
Since isLoggedIn is false, the ternary operator returns the else branch: "Please log in.". That string is rendered inside the <div>.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.