score:0

Accepted answer
  return (
    <>
      <button onClick={startCountdown}>Start countdown</button>
      {flag === 1 && (
        <h1>Count Down Started</h1>
      )}
    </>
  )

score:0

import React, { useState } from "react";
import ReactDOM from "react-dom";
import "./styles.css";

function App() {
  const [flag, setflag] = useState(0);

  const startCountdown = () => {
    setflag(1);
  };

  return (
    <>
      <button onClick={startCountdown}>Start countdown</button>
      {flag === 1 && <h1>Count Down Started</h1>}
    </>
  );
}

export default App;

score:0


  return (
    <>
      <button onClick={startCountdown}>Start countdown</button>
      {(() => {
              if (flag===1){
                console.log("INN");
                     return <h1>Count Down Started</h1>
              }
      })()}
      
    </>
  );

score:0

function App() {

  const [flag, setflag] = useState(0);

  const startCountdown = () => {
    setflag(1);    
   };


  return (
    <>
      <button onClick={startCountdown}>Start countdown</button>
      {flag === 1 && <h1>Count Down Started</>}
    </>
  );
}

export default App;

score:0

{ flag === 1 ? <h1>Count Down Started</h1> : undefined} 

Related Query

More Query from same tag