Gathering detailed insights and metrics for react-router-query-params
Gathering detailed insights and metrics for react-router-query-params
Gathering detailed insights and metrics for react-router-query-params
Gathering detailed insights and metrics for react-router-query-params
nuqs
Type-safe search params state manager for React - Like useState, but stored in the URL query string
@scaleway/use-query-params
A small hook to handle params
react-router-query-params-hook
React Hook for React Router for De-/Serializing query params
react-router-url-params
Strongly-typed way to manage URL parameters in react-router
npm install react-router-query-params
Typescript
Module System
Node Version
NPM Version
63.2
Supply Chain
91.7
Quality
80.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
209,487
Last Day
21
Last Week
327
Last Month
1,477
Last Year
10,979
MIT License
20 Stars
20 Commits
4 Forks
5 Watchers
25 Branches
1 Contributors
Updated on Jun 05, 2025
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
react-router-query-params@1.0.4
Unpacked Size
29.96 kB
Size
6.58 kB
File Count
11
NPM Version
6.13.4
Node Version
12.14.0
Cumulative downloads
Total Downloads
Last Day
90.9%
21
Compared to previous day
Last Week
-27%
327
Compared to previous week
Last Month
-6.4%
1,477
Compared to previous month
Last Year
-47.6%
10,979
Compared to previous year
3
3
28
Set query parameters with a schema for react-router.
npm install --save react-router-query-params
1import withQueryParams from 'react-router-query-params';
2...
3
4const ExampleComponent = ({
5 queryParams,
6 setQueryParams,
7}) = (
8 <div>
9 <div>
10 queryParams: {JSON.stringify(queryParams)}
11 </div>
12
13 <button onClick={() => setQueryParams({ example1: 'someQueryParam' })}>
14 Set query param example
15 </button>
16 </div>
17);
18
19const ConnectedComponent = withQueryParams({
20 stripUnknownKeys: false,
21 keys: {
22 example1: {
23 default: 'example-1-default',
24 validate: value => !!value && value.length > 3,
25 },
26 example2: {
27 default: (value, props) => props.defaultValue,
28 validate: (value, props) =>
29 !!value && !props.disallowedValues.includes(value)
30 }
31 }
32})(ExampleComponent);
queryParams
(object): All current query parameters as key-value pairs in an object.
setQueryParams
(function): Set one or more query parameters.
1this.props.setQueryParam({ key1: 'value1', key2: 'value2' })
The library exports withQueryParams
higher order component as default. The HoC takes a configuration object as the first argument, and has the following options:
stripUnknownKeys
(boolean)
true
, removes keys from query parameters that are not configured with keys
keys
(object)
1keys: { 2 example: { 3 default: 'default-value', 4 validate: () => true 5 } 6}
Key object is used to create a configuration for the query parameters that are intended to be used. Every key is configured with the following properties:
default
(any): Define the default value for the query parameter. If query parameter valiation fails or it is undefined, the HoC automatically sets the query parameter to this value. Examples:
default: 'example'
: sets 'example' as default valuedefault: (value, props) => props.defaultParam'
: sets defaultParam
from the component props as default valuedefault: undefined
: do not set query parameter at all by defaultvalidate
(function): Validate the query parameter and revert to default value if validation does not pass. Examples:
validate: () => true
: allow any aluevalidate: value => !!value && value.length > 2
: allow any value with more than two charactersvalidate: (value, props) => props.allowedValues.includes(values)
: validate value based on propsMIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
98 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More