If you want to use statements in the jsx file than you can go like below:

If Statement:

var logBtn;
if (loggedIn) {
  logBtn = <LogoutButton />;
} else {
  logBtn = <LoginButton />;
}

return (
  <div>
    <Home />
    {logBtn}
  </div>
);
Please login or Register to submit your answer

Log In

Not the answer you are looking for? Browse other questions tagged or ask your own question.