Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
Dropdown layout on hover for multiple elements

I face a problem with react.js, I'm new to it and haven't seen such questions as mine so far.

My problem is that I wanted to reproduce epic games website to learn react, but I can't manage to do the dropdown layout menu.

So here is what I've done so far (tried many things but my final result is this) :

const [selectedMenu, setSelectedMenu] = useState(null);

And the html part :

<div className="col-2" onMouseEnter={() => setSelectedMenu(1)}>
      <div className="wrapper">
        <li className="select-none bot_line">news & events</li>
      </div>
      {selectedMenu === 1 && (
        <div
          className="bot_menu"
          onMouseEnter={() => setSelectedMenu(1)}
          onMouseLeave={() => setSelectedMenu(null)}
        >}

But this is not what I want exactly, I have 7 element to set from hidden to visible. The way I want to do it is by targeting each child components with the "onMouseEnter" function through the col-2 element.

What I wish is to change the previous class to a new one by hovering col-2 to show the bot_menu onMonseEnter.The css part is done, my trouble is only with the react part. So the previous className to be "hidden" and onMouseEnter set it to "visible" className.

And to do it by targeting child elements so I only have to do it once and not 7 times.

Please

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda