강의

멘토링

커뮤니티

Inflearn Community Q&A

qwer1234's profile image
qwer1234

asked

Bite-sized Next.js

3.7) Implementing One-Bite Books UI

UI 뎁스에 관한 질문이 있습니다

Resolved

Written on

·

58

0

중첩된 라우팅에서 다른 레이아웃 혹은 레이아웃을 사용하고싶지 않을 때 어떻게 제어할 수 있는지 궁금합니다.

 

현재 소스를 보면

  • (with-searchbar)

     

    • search

    • book

    • ...

       

와 같은 형태로 되어있는 것을 알 수 있는데요

만약에 search가 1 depth 라고 했을 때,

search 페이지 아래에 예를 들어 detail-search 라는 주소를 가진 페이지가 있다고 가정할 때

  • (with-serachbar)

    • serach

      • detail-search

파일 구조 및 중첩된 라우터 구조가 위와 같이 되잖아요?

 

이 때 detail-search는 with-searchbar 대신

가령 with-detail-serachbar 라던가,

아예 with-searchbar 레이아웃을 사용하고 싶지 않을 수 있잖아요?

 

이럴 때 어떻게 해야하는지 궁금합니다 😀

reacttypescriptnext.js

Answer 1

0

winterlood님의 프로필 이미지
winterlood
Instructor

안녕하세요 이정환입니다.

라우트 그룹을 활용해 아래와 같이 설정하시면 됩니다.

 

  • (with-searchbar)

    • search

      • page.tsx

  • (with-detail-searchbar)

    • search

      • detail-search

        • page.tsx

           

qwer1234님의 프로필 이미지
qwer1234
Questioner

답변 감사합니다 !

qwer1234's profile image
qwer1234

asked

Ask a question