In This Article
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
1import { useWixFetch } from '@wix/sdk-react';2
3//...4
5const fetch = useWixFetch();6
7//...8
9const 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