@shopify/hydrogen-react
Version:
React components, hooks, and utilities for creating custom Shopify storefronts
12 lines (11 loc) • 523 B
TypeScript
export declare function loadScript(src: string, options?: {
module?: boolean;
in?: 'head' | 'body';
}): Promise<boolean>;
declare type LoadScriptParams = Parameters<typeof loadScript>;
/**
* The `useLoadScript` hook loads an external script tag in the browser. It allows React components to lazy-load large third-party dependencies.
*/
export declare function useLoadScript(url: LoadScriptParams[0], options?: LoadScriptParams[1]): ScriptState;
declare type ScriptState = 'loading' | 'done' | 'error';
export {};