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

144
Vistas
how to make a button to sort alphabetically (what could be wrong)

I'm consuming the github api showing my repos, I made an input to search the repos and it's ok my problem is when I made a button to sort from A-Z it just doesn't do anything, what could I have done wrong??

enter image description here

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your button is basically doing nothing since it's calling a function that sorts an array, then returns it. But you're not doing anything with that sorted array.

Try changing it to something like this:

const [repos, setRepos] = useState([]) // This is your state

...

<button onClick={() => {setRepos(sortedListRepo())}}>Sort</button>
about 4 years ago · Santiago Trujillo 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