Get Current Path in Next.js 14

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])