Published
- 1 min read
get url parameter in react js
The solution for this is noted below
get url parameter in react js
Solution
import React from 'react'
import { useLocation } from 'react-router-dom'
const MyComponent = () => {
const search = useLocation().search
const id = new URLSearchParams(search).get('id')
console.log(id) //12345
}
Try other methods by searching on the site. That is if this doesn’t work