No tengo problemas con el siguiente código, pero quiero asegurarme de que no haya pérdida de memoria o algo así en este componente.
const Nav = () => { const [activeNav,setActiveNav] = useState(""); const home = "#"; const inTime = () => { setActiveNav(""); }; useEffect(() => { const timer = setTimeout(() => { inTime(); },2000); return () => { clearTimeout(timer); }; },[activeNav]); return ( <nav> <a href={home} onClick={()=>setActiveNav(home)} className={activeNav===home?"active":""}><AiOutlineHome /></a> </nav> ); };