use-query-string
use-query-string copied to clipboard
Typescript / code sandbox example
Thank you for the project!
I have a bug setting up (typescript 4.3.5, use-query-string 2.4.1, query-string 6.12.0) but think it'd be most efficient if I could give a shot recreating it in a codesandbox to give a reproducible example / isolate it more
TS2488: Type 'QueryStringResult' must have a '[Symbol.iterator]()' method that returns an iterator.
147 | const HeaderComponent = ({ onPropClicked }: Props) => {
> 148 | const [query, setQuery] = useQueryString(window.location, updateQuery)
same
I was able to workaround this error via the following:
import useQueryString, { QueryStringResult } from "use-query-string";
const [query, setQuery] = useQueryString(window.location, updateQuery) as [
QueryStringResult[0],
QueryStringResult[1]
];