You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, I need to render content multiple times in a DOM, and I expect the subsequent render to overwrite the previous content. However, in the code below, all the multiple render contents are displayed
import{useState,useEffect}from'react';exportdefaultfunctionApp(){const[show,setShow]=useState(false)useEffect(()=>{setTimeout(()=>{setShow(true)},500)},[])if(!show){return<></>// I found that when this place returns a non empty value, this problem will not occur anymore}return(<><h1>Hello, world!</h1><Counter/></>);}
The current behavior
The content of both renderings has been preserved
The expected behavior
Only the last one will be retained
The text was updated successfully, but these errors were encountered:
In some cases, I need to render content multiple times in a DOM, and I expect the subsequent render to overwrite the previous content. However, in the code below, all the multiple render contents are displayed
React version: 18.2.0
Steps To Reproduce
The current behavior
The content of both renderings has been preserved
The expected behavior
Only the last one will be retained
The text was updated successfully, but these errors were encountered: