What would be the Output of the following code snippet?

(Assume all the necessary imports are done)

const Component = () =>{
  const [showElement,setShowElement] = useState(true)
  useEffect(()=>{
    setTimeout(function() {
      setShowElement(false)
         }, 4000);
       },
   [])
      
  return(
    <div>
       {showElement?<div>I'm here and i will be gone</div>:<></>} 
    </div>
  )
}

“I'm here and I will be gone” will be displayed.

“I'm here and I will be gone” will be displayed after 4 seconds.

“I'm here and I will be gone” will be displayed for 4 seconds.

None of the above

Verified Answer
Correct Option - c

To get all Infosys Certified React Web Developer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram