Next.jsã®Linkã¨Routerã®æåãããåãããªãã£ãã®ã§ãNext.jsã®ã³ã¼ããªã¼ãã£ã³ã°ãããããã¼ã¸é·ç§»ããã¼ã¸ãã¼ãã®ä»çµã¿ãçµæ§ã¤ãããã®ã§ã¡ã¢ã Linkã§ã¯ã¯ãªãã¯ããã¨singletonRouterã®pushãå¼ãã§ãã pushã¯changeã¡ã½ãããå¼ãã§ãã next/next-server/lib/router/router.ts change pathnameãqueryã¯ãurlãã¤ã¾ãLinkã®hrefããæ½åºãã¦ãã routeã¯ãã pathnameããæå¾ã®/ãæ¶ããã ã dynamic routeã®å ´å(/posts/[id]ã¿ããã«ãªã£ã¦ãããã¤)ãªããhrefã¨asãæ¯ã¹ã¦ãã©ã¡ã¼ã¿ãæãåºãã¦ãqueryã«çªã£è¾¼ãã§ãã ãã®ã¸ãã§getRouteInfoã使ã£ã¦ãrouteã¨ãpathnameããã³ã³ãã¼ãã³ããç¹å®ãããã¨ãã¦ãã
{{#tags}}- {{label}}
{{/tags}}