Conditions for returning a tag in JSX
You can return a variable containing a tag via return:
function App() {
let text;
const show = true;
if (show) {
text = <p>text1</p>;
} else {
text = <p>text2</p>;
}
return text;
}
Let the constant isAdmin contain true if the user is an admin, and false if not:
function App() {
const isAdmin = true;
}
Make it so that if isAdmin is true, the paragraph div will show up. Otherwise, nothing should show up.