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

122
Vistas
Cant get data with Axios

I'm trying to learn basic React I want to build the cocktail page which allows the user to search for specific cocktails I've used cocktailsdb API but and tried to use Axios but when I'm trying to search the result won't come out because there is no data. I don't know the source for this problem image

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

0

The issue is because you've got a line break here: https://github.com/MatanSofer/Cocktail-Bar/blob/e21c5cc266c23cb2e47e26ea31de102ef26d791f/components/search/Search.js#L27

Particularly this line:

axios
      .get(`https://thecocktaildb.com/api/json/v1/1/search.php?s=
      ${term}`)  //pay attention is the letter next to digit 1

If you look at the network request, you'll see a tun of spaces preceding the search term.

invalid search term

If you change that line to:

 axios
      .get(`https://thecocktaildb.com/api/json/v1/1/search.php?s=${term}`)

It works fine:

enter image description here

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