useWixFetch()

The useWixFetch() hook returns a function used to call endpoints from the Wix REST API using the authentication details provided to the WixProvider. Only use this function if the functionality you're looking for doesn't yet exist in the JavaScript SDK.

Note: This hook must be used inside an enclosing WixProvider component.

Example

Copy
1
import { useWixFetch } from '@wix/sdk-react';
2
3
//...
4
5
const fetch = useWixFetch();
6
7
//...
8
9
const response = await fetch(
10
'https://www.wixapis.com/stores/v1/products/query',
11
{
12
method: 'POST',
13
headers: {
14
'Content-Type': 'app/json',
15
},
16
body: JSON.stringify({}),
17
}
18
);
Was this helpful?
Yes
No