Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

300
Vistas
How to change props object name when it's clicked in react?

I'm creating a youtube clone using react js and i used this icon

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

That looks like this HomeIconfilled

which gets rendered by calling this function

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

That takes 2 parameters and reder the icon

function Sidebariconfunc({Icon,Title}) {


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

How can i chane the props name to HomeIcon when i click on the icon so that it changes to this this icon HomeIcon Thamks !

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

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>
  )
}

Usage:

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda