Created
May 26, 2023 13:46
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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