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

139
Views
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 answers
Answer question

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 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!