Licence
ISC
Version
0.1.11
Deps
0
Size
2 kB
Vulns
0
Weekly
0
USE-PARAMS-QUERY
React hook to get the all query params from the url or to get the value of a particular key.
Installation:
npm i use-params-query -s
Basic Usage:
import useQueryParams, { useQueryParam } from "use-params-query";
const params = useQueryParams();
const param = useQueryParam("name");
Example:
for the below url the results will be as follows.
http://localhost:3000?name=Sam&age=20
const params = useQueryParams();
the result will be: [{name: 'Sam'}, {age: 20}]
const param = useQueryParam("name");
the result will be: Sam