A React Hook to use the URLSearchParams utility methods
npm install use-search-paramsReact Hook to use the URLSearchParams utility methods.




``bash`
npm install use-search-params --save
`bash`
yarn add use-search-params
The hook returns the current url query string value together with the URLSearchParams methods to manipulate it.
`JavaScript
import useSearchParams from 'use-search-params';
const MyComponent = () => {
const [
queryString,
{ append, entries, get, getAll, has, keys, remove, set, sort, values }
] = useSearchParams();
const entries = entries();
const keys = keys();
const values = values();
const value = get('key');
const allValues = getAll('key');
const hasKey = has('key');
return (
Query string: {queryString}
This hook uses the URLSearchParams api
MIT