https://nextjs.org/docs/app/api-reference/functions/use-router
import { useRouter } from "next/navigation";
라우터를 참 쉽게 만들어주는 녀석!
}, [pathname, searchParams]);
return null;
'use client';
import { useEffect } from 'react';
import { usePathname, useSearchParams } from 'next/navigation';
export function NavigationEvents() {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
const url = pathname + searchParams.toString();
console.log(url);
}
// You can now use the current URL
// ...