useQuery results in having this error: TypeError: url__WEBPACK_IMPORTED_MODULE_0__.URLSearchParams
This is my first time using react query, and I seem to be running into some difficulties, some help would be appreciated.
I have an api endpoint that when I call manually, results in valid data being returned: (see screenshot 1)
The code for this in short is:
When I try convert this into a query, as so:
hook:
browser throw error of
TypeError: url__WEBPACK_IMPORTED_MODULE_0__.URLSearchParams is not a constructor
What am I doing wrong? I am using Next js.
I will also mention that, when I change the api code to return a simple array:
Then, the query returns the array as expected.
1 Reply
extended-salmonOP•11mo ago
after some time now the query throws a cors error in the browser.
When I don't use tanstack query for the request, it works fine.
I'm not sure what's wrong.
I managed to resolve this, I have no idea how to close this thread 🙂