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 Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in