React router hooks for Shopify app
🏠 Homepage
You can use official linkComponent
prop if you don't expect to change Shopify App host URL.
https://polaris.shopify.com/components/structure/app-provider#using-linkcomponent
If you expect to change Shopify App host URL too, you need to call App Bridge History API. @huckleberry-inc/shopify-app-history provides function for that.
import { useShopifyHistory } from '@huckleberry-inc/shopify-app-history';
import createApp from '@shopify/app-bridge';
const app = createApp({
apiKey: 'API key from Shopify Partner Dashboard',
shopOrigin,
});
// React hooks
const to = useShopifyHistory(app);
// You can use it in React Component
const jump = () => { to("/another_page") }
Also, You can check React router API docs.
yarn add @huckleberry-inc/shopify-app-history
👤 Huckleberry, inc. [email protected]
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator