Skip to content

Instantly share code, notes, and snippets.

@NGR-NP
Created May 26, 2023 13:46
Show Gist options
  • Save NGR-NP/15d91fb4740c28f96ddbd91d5dbfa527 to your computer and use it in GitHub Desktop.
Save NGR-NP/15d91fb4740c28f96ddbd91d5dbfa527 to your computer and use it in GitHub Desktop.
access and extract the specific query parameters from url in react js
const extractquery = ()=>{
const { search } = useLocation(); /// ?page=1&limit=10
const params = new URLSearchParams(search);
const limit = params.get("limit"); // 10
return{
<div>{limit}</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment