Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

make a if in jsx

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

return (
  <nav>
    <Home />
    {loginButton}
  </nav>
);
Source by react-cn.github.io #
 
PREVIOUS NEXT
Tagged: #jsx
ADD COMMENT
Topic
Name
2+6 =