We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 057c376 commit a061836Copy full SHA for a061836
src/useQueryState.ts
@@ -1,5 +1,5 @@
1
-import React from 'react'
2
import { useRouter } from 'next/router'
+import React from 'react'
3
import { HistoryOptions, Serializers } from './defs'
4
5
export interface UseQueryStateOptions<T> extends Serializers<T> {
@@ -116,7 +116,7 @@ export function useQueryState<T = string>(
116
}
117
const query = new URLSearchParams(window.location.search)
118
const value = query.get(key)
119
- return value ? parse(value) : null
+ return value !== null ? parse(value) : null
120
}, [])
121
122
// Update the state value only when the relevant key changes.
0 commit comments