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

158
Views
How to get key value from url

I am using Axios to fetch data from API. From one page I am sending data through URL to another page which I want to use on another page.

http://localhost:3000/otp?email=test.k@gmail.com

I want to get the value of email. In reacting project I am using react-router-dom, Axios, hooks.

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

0

One solution using hooks:

import { useLocation } from 'react-router-dom'

const location = useLocation()
const email = new URL(location.href).searchParams.get('email')
about 4 years ago · Juan Pablo Isaza Report

0

You can use VanillaJS

const params = new URLSearchParams(window.location.search)
const email = params.urlParams.get('email');
console.log(email)
about 4 years ago · Juan Pablo Isaza Report

0

You can use useLocation hook from react-router-dom, for example:

import { useLocation } from "react-router-dom";

const Component = () => {
  const query = new URLSearchParams(useLocation().search);

  return <div>{query.get('email')}</div>
}

It's also important to know the difference between params and queries in the routes.

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!