useAppBridge
Requires
@shopify/app-bridge-react@v4 and the app-bridge.js script tagRequires [`@shopify/app-bridge-react@v4`](https://www.npmjs.com/package/@shopify/app-bridge-react) and the [`app-bridge.js` script tag](/docs/api/app-bridge-library#getting-started):
The useAppBridge hook returns the shopify global variable to use App Bridge APIs such as toast and resourcePicker.
Anchor to Use casesUse cases
- React integration: Access the
shopifyglobal in React components to use App Bridge APIs like toast and resource picker. - Server rendering: Safely access App Bridge during server-side rendering where the
shopifyglobal isn't available. - API access: Use the returned
shopifyobject to call any App Bridge API from within a React component. - Framework compatibility: Integrate App Bridge with React-based frameworks like React Router or Remix.
The hook is available for use in your app. It returns the shopify global or a proxy when not in a browser environment.
For more information, see the global variable section and the individual reference pages like Toast and Resource Picker.
export interface UseAppBridge {}export interface UseAppBridge {}
Was this page helpful?