Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
Mostrar parámetro http si el valor no está vacío

En la aplicación React, uso este código para establecer el valor como parámetro de ruta de URL:

 const [exchangeId, setExchangeId] = useState(''); ..... const endURL = `?page=${paginationState.activePage}&sort=${paginationState.sort},${paginationState.order}&exchangeId=${exchangeId}`; .....

Cuando no configuro con algún valor exchangeId , obtengo siempre una url vacía param exchangeId=

¿Sabe cómo puedo implementar una verificación si exchangeId no está configurado para no incluir exchangeId= en el enlace http?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede utilizar operadores condicionales (ternarios).

 const exchangeId = ''; const paginationState = { activePage: 1, sort: 1, order: 1 } const endURL = `?page=${paginationState.activePage}&sort=${paginationState.sort}&order=${paginationState.order}${exchangeId ? `&exchangeId=${exchangeId}` : ''}`; console.log(endURL);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!