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

276
Vistas
location.search is undefined but location is where the application runs

I have this code in my application.

const queryString = require('query-string');
const parsed = queryString.parse(location.search);
return this.docListingService.getPacks(parsed.policy).then(packs => {
    this.setState({ isLoading: false, packs });
    return packs;
}).catch((error) => {
    this.loggingService.logError('Error returning Docs ' + error);
    this.setState({ errorOccured: true});
});

It doesn't work because location.search is undefined.

I can see that location is http://localhost:3000/ which is where this application is running. How can/should this be set?

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

0

You can't using dot notaion on strings!

Based on this You can try this (if you are using react hooks), first of all define location: const location = useLocation();

about 4 years ago · Juan Pablo Isaza Denunciar

0

Try to investigate a little bit:

  • https://developer.mozilla.org/en-US/docs/Web/API/Location/search
  • https://www.w3schools.com/jsref/prop_loc_search.asp

Location search is a funtion that returns the queryString of the url. you dont have a queryString in your URL ..your/whole/url?queryStringOverHere=something

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