Conditionaly Rendering

PHOTO EMBED

Mon Jun 19 2023 17:40:20 GMT+0000 (Coordinated Universal Time)

Saved by @sarfraz_sheth #react.js

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;
content_copyCOPY

apply if condition and outside varibles to check and render