관리 메뉴

Silver Library (Archived)

Next.js vs recat-router-dom? 본문

Face the fear, build the future/Library of Logging

Next.js vs recat-router-dom?

Chesed Kim 2022. 11. 13. 15:20
반응형

이 글은 다음으로 이어집니다.

https://silverlibrary.tistory.com/484

 

What is possible and not : Next.js + some example

This page is a summary of an article written by Reed Barger, for personal use. Does: Page-based routing (create a page by putting components in /pages) A built-in router (no need to install React Router) API routes (write backend code using Node.js in /pag

silverlibrary.tistory.com

next.js 로 가지고 이것저것 해보면서 느낀게 있습니다. 이걸로 'react-router-dom 을 대체 할 수 있겠다' 는 점.

그리고 react-router-dom 을 안해도 된다는 것은, 이점도 있었다는 거죠. 일단 SSR(server side rendering) 을 하려면 react-router-dom 보다는 next.js 가 좋다. 라는 결론이 나왔습니다.

 

예를 들면 dynamic route 나 nested route 를 못하는 것 같아 보여도, 이걸 또 지원을 합니다. 그래서 dynamic 이던 nested 던 next.js 로도 이젠 가능하다. 라는 결론입니다.

 

이제 이 react-router-dom 문제는 한시름 놓은 느낌입니다.

 

다음 글에서는 할 수 있는게 뭐가 있을까 에 대해 정리해보겠습니다.

 

용어 설명.

nested routing (중첩 라우팅)

https://www.daleseo.com/react-router-nested/

 

React Router로 중첩 라우팅 하기

Engineering Blog by Dale Seo

www.daleseo.com

dynamic routing (동적 라우팅)

https://nextjs.org/docs/routing/dynamic-routes

 

Routing: Dynamic Routes | Next.js

Dynamic Routes are pages that allow you to add custom params to your URLs. Start creating Dynamic Routes and learn more here.

nextjs.org