Installations
npm install @scaleway/use-query-params
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=20.x
Node Version
20.18.1
NPM Version
10.8.2
Releases
@scaleway/eslint-config-react@5.2.6
Published on 03 Feb 2025
@scaleway/use-segment@1.1.10
Published on 27 Jan 2025
@scaleway/eslint-config-react@5.2.5
Published on 27 Jan 2025
@scaleway/cookie-consent@2.0.9
Published on 27 Jan 2025
@scaleway/use-query-params@5.0.13
Published on 27 Jan 2025
@scaleway/validate-icu-locales@3.1.10
Published on 27 Jan 2025
Contributors
Languages
TypeScript (90.43%)
JavaScript (9.2%)
Python (0.37%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
scaleway
Download Statistics
Total Downloads
486,218
Last Day
510
Last Week
1,424
Last Month
6,404
Last Year
102,232
GitHub Statistics
27 Stars
2,817 Commits
9 Forks
12 Watching
32 Branches
42 Contributors
Bundle Size
8.07 kB
Minified
2.87 kB
Minified + Gzipped
Package Meta Information
Latest Version
5.0.12
Package Id
@scaleway/use-query-params@5.0.12
Unpacked Size
8.39 kB
Size
2.92 kB
File Count
5
NPM Version
10.8.2
Node Version
20.18.1
Publised On
30 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
486,218
Last day
104.8%
510
Compared to previous day
Last week
1%
1,424
Compared to previous week
Last month
-33.2%
6,404
Compared to previous month
Last year
-55.7%
102,232
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Peer Dependencies
3
Dev Dependencies
3
@scaleway/use-query-params
A tiny hooks to handle use-query-params
Install
1$ pnpm add @scaleway/use-query-params react-router-dom
Usage
1import React from 'react' 2import { render } from 'react-dom' 3import { BrowserRouter as Router } from 'react-router-dom' 4import useQueryParams from '@scaleway/use-query-params' 5 6const App = () => { 7 const { queryParams, setQueryParams } = useQueryParams() 8 const { user } = queryParams 9 const setUser = () => setQueryParams({ user: 'John' }) 10 // ?user=John 11 12 return ( 13 <> 14 <h1>User: {user}</h1> 15 <button onClick={setUser}>Set User John</button> 16 </> 17 ) 18} 19 20render( 21 <Router> 22 <App /> 23 </Router>, 24 document.getElementById('react-root'), 25)
Set query params
Merge current query params with the new ones passed in parameters.
1// In this exemple we assume that we have an URL that include : `?company=Scaleway". 2import React from 'react' 3import useQueryParams from '@scaleway/use-query-params' 4 5const Component = () => { 6 const { queryParams, setQueryParams } = useQueryParams() 7 const { user, company } = queryParams // user will be undefined and company will be "Scaleway" 8 const setUser = () => setQueryParams({ user: 'John' }) // user will be "John" and company will be "Scaleway" 9 // ?company=Scaleway&user=John 10 11 return ( 12 <> 13 <h1>User: {user}</h1> 14 <h1>Company: {company}</h1> 15 <button onClick={setUser}>Set User John</button> 16 </> 17 ) 18}
Replace query params
Erase current query params and replace by the new ones passed in parameters.
1// In this exemple we assume that we have an URL that include : `?company=Scaleway". 2import React from 'react' 3import useQueryParams from '@scaleway/use-query-params' 4 5const Component = () => { 6 const { queryParams, replaceQueryParams } = useQueryParams() 7 const { user, company } = queryParams // user will be undefined and company will be "Scaleway" 8 const setUser = () => replaceQueryParams({ user: 'John' }) // user will be "John" and company will be undefined 9 // ?user=John 10 11 return ( 12 <> 13 <h1>User: {user}</h1> 14 <h1>Company: {company}</h1> 15 <button onClick={setUser}>Set User John</button> 16 </> 17 ) 18}
Push onto the stack instead of replacing
To avoid mutating history
1// In this exemple we assume that we have an URL that include : `?company=Scaleway". 2import React from 'react' 3import useQueryParams from '@scaleway/use-query-params' 4 5const Component = () => { 6 const { queryParams, replaceQueryParams } = useQueryParams() 7 const { user, company } = queryParams // user will be undefined and company will be "Scaleway" 8 const setUser = () => replaceQueryParams({ user: 'John' }, { push: true }) // user will be "John" and company will be undefined 9 // ?user=John 10 11 return ( 12 <> 13 <h1>User: {user}</h1> 14 <h1>Company: {company}</h1> 15 <button onClick={setUser}>Set User John</button> 16 </> 17 ) 18}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
no binaries found in the repo
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/changesets-renovate.yml:1
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Warn: no topLevel permission defined: .github/workflows/pull_request_title.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Info: no jobLevel write permissions found
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/changesets-renovate.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/changesets-renovate.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/changesets-renovate.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/changesets-renovate.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request_title.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/pull_request_title.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request_title.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/pull_request_title.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request_title.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/pull_request_title.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/scaleway/scaleway-lib/release.yml/main?enable=pin
- Info: 0 out of 13 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 9 third-party GitHubAction dependencies pinned
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Score
5.2
/10
Last Scanned on 2025-01-27
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