App reviews, troubleshooting, and recommendations
Hello.
I want to use Navigation in Next.js,
But There are no contents React Hooks or React Components in docs(https://shopify.dev/docs/api/app-bridge-library/apis/navigation )
unlike previous-version docs(https://shopify.dev/docs/api/app-bridge/previous-versions/actions/navigation )
Only Remix version of the guide exists in that document.
(I don't have any plan using Remix.)
How to Migrate useNavigate in App Bridge React 4.x.x using Next.js?
Thank you.
Hi @camerafi-dev ,
Did you find a solution for it?
Thank you.
Hi @camerafi-dev,
I don't use Next.js but ended up here while looking for a solution for vanilla react.
There is a hook in the react-router-dom library. So this works for me:
import { Link } from "@shopify/polaris";
import { useNavigate } from "react-router-dom";
const navigate = useNavigate();
<Link onClick={() => navigate(`/page`)}>Page</Link>
import { Link } from "@shopify/polaris";
import { useRouter } from 'next/navigation'
const router = useRouter();
<Link onClick={() => router.push(`/page`)}>Page</Link>
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025