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

231
Visualizações
How to conditionally show list items in React based on screen size

I am trying to create a navigation with a 'more' menu. It seems to be a fairly simple concept.. CBS Sports is an example of it (https://www.cbssports.com/)

Basically show as many links as possible, and push the rest to the dropdown.

Is there a correct approach to implementing this in react? Basically change the count of visible items based on the size of the screen?

I've been trying to find an example of an implementation but am not sure how to find it.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Changing the count of visible items based on the size of the screen for me is a good idea. You can create variable which give you number of visible items. Later you can map after filtered items from array which contains all items. For example

arr.filter((_,i)=> i < number).map(item=> (<li>{item}</li>))

and for item which go to dropdown

arr.filter((_,i)=> i >= number).map(item=> (<li>{item}</li>))
about 4 years ago · Juan Pablo Isaza Relatório
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