Global
Global hooks are React hooks that relate to your entire app. You use global hooks to fetch data from server components.
Hydrogen includes the following global hooks:
Hook name | Description |
---|---|
fetchSync | The fetchSync hook makes API requests and is the recommended way to make simple fetch calls on the server. |
useQuery | The useQuery hook executes an asynchronous operation like fetch in a way that supports Suspense. |
useServerProps | The useServerProps hook enables you to manage server props passed to your server components when using Hydrogen as a React Server Component framework. |
useShop | The useShop hook provides access to values within hydrogen.config.js . |
useShopQuery | The useShopQuery hook enables you to make server-only GraphQL queries to the Storefront API. |
useUrl | The useUrl hook retrieves the current URL in a server or client component. |