Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
¿Cómo cambiar el nombre del objeto de accesorios cuando se hace clic en reaccionar?

Estoy creando un clon de youtube usando react js y usé este ícono

 import HomeIconfilled from '@mui/icons-material/Home'; import HomeIcon from '@mui/icons-material/HomeOutlined';

Eso se parece a este HomeIconfilled

que se representa llamando a esta función

 <Sidebariconfunc Icon={HomeIconfilled} Title="Home"/>

Eso toma 2 parámetros y vuelve a poner el ícono

 function Sidebariconfunc({Icon,Title}) { return ( <div className='SidebarRow'> <div className='Sidebar_Icon'> <Icon/> </div> <div className='Slidebar_Title'> {Title} </div> </div> ) }

¿Cómo puedo cambiar el nombre de los accesorios a HomeIcon cuando hago clic en el icono para que cambie a este icono ? HomeIcon ¡Gracias!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

function SidebarIcon({ActiveIcon, InactiveIcon, title, isActive}) { return ( <div className='SidebarRow'> <div className='Sidebar_Icon'> {isActive ? <ActiveIcon/> : <InactiveIcon /> </div> <div className='Slidebar_Title'>{Title}</div> </div> ) }

Uso:

 const [isActive, setIsActive] = React.useState(false) return ( <a onClick={() => setIsActive(!isActive)> <SidebarIcon ActiveIcon={HomeIconfilled} InactiveIcon={HomeIcon} title='Home' isActive={isActive} /> </a> )
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!