In Next.js app directory, we use usePathname instead of useRouter.
"use client";
import { usePathname } from "next/navigation";
const path = usePathname();
useEffect(() => {
console.log('current path: ', path)
}, [path])
In Next.js app directory, we use usePathname instead of useRouter.
"use client";
import { usePathname } from "next/navigation";
const path = usePathname();
useEffect(() => {
console.log('current path: ', path)
}, [path])