v3.2.0
Fixes and feats.
- Removes unnecessary '?' at end of urls that don't have query params
- Adds support for array query params
Added support for lists of query params. Example:
"use client"
import useFetch from "@/httpreact"
export default function Home() {
const { data } = useFetch("/api/something/1", {
query: {
a: 1,
b: [2, 3, 4, "hello there"],
},
})
return (
<main className="p-24">
<h2>Home page</h2>
<pre>{serialize(data, null, 2)}</pre>
</main>
)
}The requested url will be: /api/something/1?a=1&b=2&b=3&b=4&b=hello%20there, and the network tab should show something like this:
