Hydrogen utilities overview

Hydrogen utilities are functions that perform different tasks to help you develop quickly.

Utility name Description
flattenConnection Transforms a connection object into a flat array.
gql Adds syntax highlighting to your GraphQL queries.
isBrowser Indicates if the code executed in the browser.
isServer Indicates if the code executed on the server.
log Logs debugging, warning, and error information about the application.
parseMetafield Creates a new metafield object with a value that has been parsed according to the metafield type.
parseMetafieldValue Parses a metafield's value from a string to a sensible type corresponding to the metafield's type.

Helps you query the Storefront API within API routes.

Use the useShopQuery hook for server-side queries to the Storefront API.