Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
Saving parts of URL information for reuse in React

How can one take the information of a URL?

I want to use the appended information on this URL http://localhost:3000/transaction?transactionId=72U8ALPE in a fetch API.

I am trying to take the value 72U8ALPE and save it to state or as a variable. Then use if on the URL I will use on a fetch request. For example

https://google.com/${the-url-last-part-saved-as-variable-or-in-state}

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can get the query parameters from the URL object. This could look something like this:

let currentUrl = new URL(window.location);
let transactionId = currentUrl.searchParams.get('transactionId');

You can then use the variable to append to your HTTP request.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda