import React from "react"; var isLoggedIn = true; function renderconditionally (){ if (isLoggedIn === true){ return <h1>Hello Men </h1> }else{ return(<form className="form"> <input type="text" placeholder="Username" /> <input type="password" placeholder="Password" /> <button type="submit">Login</button> </form>) } } function App() { return ( <div className="container"> {renderconditionally()} </div> ); } export default App;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter