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

238
Vistas
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 Respuestas
Responde la pregunta

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