React/Next.js
-
next는 페이지 만들기도 엄청 쉽네?React/Next.js 2023. 1. 31. 11:51
이전 남긴 글에서는 next가 폴더기준으로 route설정을 하는 것 같다고 적었는데 아니였다. file로 인식을 하는거시여따!!!! 이렇게 about.js 파일을 pages 폴더 안에 만들어봤다. 코드를 적으면서, next가 / 뒤 주소를 뭘로 정할지 궁금했다. 컴포넌트 이름은 Potal로 만들고 파일을 about.js로 만들었다. 3000/about 으로 접숙했을 때 about이 잘 뜨고있다. 근데 여기서 또 궁금한게 생겼다. 저 export를 지우면? 에러가 나는거슬 볼 수 있다. export를 해주면 똑똑한 next가 알아서 import를 해서 routing을 해주는 것 같다. 오호라..좋은걸? 이런식으로 위에 abc.js도 만들어줬고 3000/abc 로 접속해도 페이지가 잘 뜨고 있다. 근데, i..