파피루스

NextRouter was not mounted. https://nextjs.org/docs/messages/next-router-not-mounted 본문

Today I Learned/in dev

NextRouter was not mounted. https://nextjs.org/docs/messages/next-router-not-mounted

떼굴펜 2024. 7. 8. 23:00

 

문제 상황 캡쳐

 

 

 

해결

useRouter는 next/router가 아닌 next/navigation모듈을 사용해야한다.

 

문제 해결 전

"use client";

import { useRouter } from "next/router";

 

문제 해결 후

"use client";

import { useRouter } from "next/navigation";