• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

navigate(history 변경)이 계속 오류가 발생하네요

23.02.06 14:00 작성 조회수 846

0

이렇게 코드를 작성하였는데

history.ts:480 Uncaught Error: useNavigate() may be used only in the context of a <Router> component. 에러가 발생합니다 ㅠㅠ

답변 1

답변을 작성해보세요.

0

안녕하세요!

아마 App.js나 index.js 에서 BrowserRouter를 사용해 주셨나요?!!

https://reactrouter.com/en/main/router-components/browser-router

여기에 있는 것처럼 감싸주세요 ~