[오류해결] <Outlet /> with a null value by default resulting in an "empty" page.

류정민·2022년 3월 28일

오류해결

목록 보기
1/1
post-thumbnail

기존 코드는 이렇게 작성하였었는데,

    <BrowserRouter>
        <Sidebar></Sidebar>
        <Routes>
          <Route component={Daily}  path="/" exact />
          <Route component={Monthly} path="/monthly"  />
        </Routes>
    </BrowserRouter>

This means it will render an with a null value by default resulting in an "empty" page.
위와 같은 에러가 계속 발생하였다.

해결하기 위해 서치하던중, 같은 문제로 보이는 글을 발견하였고 component를 대신하여 element를 사용하니 해결되었다.

   <BrowserRouter>
        <Sidebar></Sidebar>
        <Routes>
          <Route element={<Daily/>} path="/" exact  />
          <Route element={<Monthly/>} path="/monthly"  />
        </Routes>
   </BrowserRouter>

참고 : https://stackoverflow.com/questions/69854011/matched-leaf-route-at-location-does-not-have-an-element

profile
To Infinity, And Beyond 🚀

0개의 댓글