Skip to content

Commit 0144eb9

Browse files
authored
Update useQueryString.js
1 parent 60c947e commit 0144eb9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/useQueryString.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export const defaultOptions = {
1414
}
1515
}
1616

17+
/** @type {React.Context<object>} */
18+
export const queryStringContext = React.createContext({ update: replaceQueryString, search: null, options: defaultOptions })
19+
20+
const listeners = new Set()
21+
const EMPTY = {}
22+
1723
export function useQueryString() {
1824
const { search, update, options } = React.useContext(queryStringContext)
1925
const [query, setQuery] = React.useState(() => search ? qs.parse(search, options.parse) : EMPTY)

0 commit comments

Comments
 (0)