UNPKG

@shopify/app-bridge-host

Version:

App Bridge Host contains components and middleware to be consumed by the app's host, as well as the host itself. The middleware and `Frame` component are responsible for facilitating communication between the client and host, and used to act on actions se

16 lines (12 loc) 550 B
'use strict'; var React = require('react'); var Error = require('@shopify/app-bridge-core/actions/Error'); var HostProvider = require('../HostProvider.js'); function useRouterContext() { var context = React.useContext(HostProvider.RouterContext); if (!context) { throw Error.fromAction('Missing required Host Context. Your component must be wrapped in a <HostProvider> component with the `router` prop provided', Error.AppActionType.MISSING_ROUTER_CONTEXT); } return context; } exports.useRouterContext = useRouterContext;