{"id":1662,"date":"2022-09-04T16:27:52","date_gmt":"2022-09-04T07:27:52","guid":{"rendered":"https:\/\/teno-hira.com\/media\/?p=1662"},"modified":"2022-09-06T19:35:16","modified_gmt":"2022-09-06T10:35:16","slug":"next-js%e3%82%92%e5%b0%91%e3%81%97%e3%81%9a%e3%81%a4%e7%90%86%e8%a7%a3%e3%81%97%e3%81%a6%e3%81%84%e3%81%8f4%ef%bd%9c%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e6%a9%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/teno-hira.com\/media\/?p=1662","title":{"rendered":"Next.js\u3092\u5c11\u3057\u305a\u3064\u7406\u89e3\u3057\u3066\u3044\u304f4\u3010\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u6a5f\u80fd\u3011"},"content":{"rendered":"<p>\u4eca\u56de\u306fNext.js\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u6a5f\u80fd\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002Next.js\u306fpages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d5\u30a1\u30a4\u30eb\u30fb\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u304c\u305d\u306e\u307e\u307e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u57fa\u672c\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u30cd\u30b9\u30c8\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u30cd\u30b9\u30c8\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u53d6\u5f97\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u305d\u306e\u24ea\uff5cNext.js\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b<\/h2>\n<p>\uff08\u74b0\u5883\u69cb\u7bc9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u4eba\u306f\u6b21\u7ae0\u300c\u305d\u306e\u2460\u300d\u306b\u9032\u3093\u3067\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>Next.js\u306e\u74b0\u5883\u69cb\u7bc9\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/teno-hira.com\/media\/?p=1648\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"360\" height=\"360\" alt=\"Next.js\u3092\u5c11\u3057\u305a\u3064\u7406\u89e3\u3057\u3066\u3044\u304f2\u3010\u74b0\u5883\u69cb\u7bc9\u3011\" loading=\"lazy\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/undraw_next_js_8g5m-360x360.png\" class=\"lazyload\"><\/div><div class=\"title\">Next.js\u3092\u5c11\u3057\u305a\u3064\u7406\u89e3\u3057\u3066\u3044\u304f2\u3010\u74b0\u5883\u69cb\u7bc9\u3011<\/div><div class=\"date\">2022.9.4<\/div><div class=\"substr\">\u4eca\u56de\u306f\u3001\u4eca\u5f8c\u306e\u5b66\u7fd2\u306b\u6d3b\u7528\u3059\u308bNext.js\u306e\u74b0\u5883\u69cb\u7bc9\u306e\u624b\u9806\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002Next.js\u3092\u5c0e\u5165\u3059\u308b\u306b\u306f\u304a\u624b\u5143\u306e\u74b0\u5883\u306bNode.js\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u3068\u306a\u308a\u307e\u3059\u3002  Node.js\u3001WSL\u306a\u3069\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u306b\u3064\u3044\u3066 \u672c\u8a18\u4e8b\u3067\u306fNode.js\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u89e3\u8aac\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u305d...<\/div><\/a><\/div>\n<h2>\u305d\u306e\u2460\uff5cNext.js\u306e\u57fa\u672c\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<p>Next.js\u306f\u3001pages\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\uff08\u307e\u305f\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff09\u69cb\u6210\u306b\u5bfe\u5fdc\u3057\u3066\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u884c\u3044\u307e\u3059\u3002\u5b9f\u969b\u306b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>pages\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3001product.js\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">touch pages\/product.js<\/code><\/pre>\n<p><strong>pages\/product.js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">function Product() {\r\n return &lt;h2&gt;Product Page&lt;\/h2&gt;\r\n}\r\n\r\nexport default Product<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067localhost:3000\/product\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u305f\u3063\u305f\u4eca\u4f5c\u6210\u3057\u305f\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/nextjs4-2-1.png\" alt=\"\" width=\"673\" height=\"397\" class=\"alignnone size-full wp-image-1670 lazyload\" \/><\/p>\n<h2>\u305d\u306e\u2461\uff5cNext.js\u306e\u30cd\u30b9\u30c8\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<p>Web\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u3068<code>\u25cb\u25cb\u25cb.com\/product\/1<\/code>\u306e\u69d8\u306b\u3001product\u30da\u30fc\u30b8\u306e\u3055\u3089\u306b\u5965\u306b\u30da\u30fc\u30b8\u3092\u7528\u610f\u3057\u3066\u3001\u3044\u308f\u3086\u308b\u300c\u5165\u308c\u5b50\uff08\u30cd\u30b9\u30c8\/Nest\uff09\u69cb\u9020\u300d\u3092\u5b9f\u73fe\u3057\u305f\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002Next.js\u3067\u306f\u3001pages\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u7528\u610f\u3057\u3001\u305d\u306e\u4e2d\u306bJS\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u30cd\u30b9\u30c8\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u307e\u305a\u306fpages\u30d5\u30a9\u30eb\u30c0\u5185\u306bproduct\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3001product\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306bindex.js\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b\u305d\u306e\u2460\u3067\u4f5c\u6210\u3057\u305fpages\/product.js\u30d5\u30a1\u30a4\u30eb\u306f\u3042\u3089\u304b\u3058\u3081\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">mkdir product\r\ntouch pages\/product\/index.js<\/code><\/pre>\n<p><strong>\/pages\/product\/index.js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">function Product() {\r\n return &lt;h2&gt;Product Page (Nest)&lt;\/h2&gt;\r\n}\r\n\r\nexport default Product<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u5148\u307b\u3069\u540c\u69d8\u3001<code>localhost:3000\/product<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u300cProduct Page (Nest)\u300d\u3068\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002\uff08\u8868\u793a\u3055\u308c\u306a\u3044\u5834\u5408\u3001\u305d\u306e\u2460\u3067\u4f5c\u6210\u3057\u305fproduct.js\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3057\u3066\u304b\u3089\u518d\u5ea6\u8a66\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u7d9a\u3044\u3066\u306f\u3001\u5165\u308c\u5b50\u30da\u30fc\u30b8\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306bproduct\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u306b1.js\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">touch pages\/product\/1.js<\/code><\/pre>\n<p><strong>pages\/product\/1.js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">function Product_1() {\r\n return &lt;h2&gt;Details about product 1&lt;\/h2&gt;\r\n}\r\n\r\nexport default Product_1<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>localhost:3000\/product\/1\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u300cDetails about product 1\u300d\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/nextjs4-1.png\" alt=\"\" width=\"658\" height=\"379\" class=\"alignnone size-full wp-image-1665 lazyload\" \/><\/p>\n<h2>\u305d\u306e\u2462\uff5cNext.js\u306e\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<p><code>\u25cb\u25cb\u25cb.com\/product\/1<\/code>\u306e\u69d8\u306a\u30cd\u30b9\u30c8\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u884c\u3046\u5834\u5408\u3001\u5165\u308c\u5b50\u30da\u30fc\u30b8\u3092\u3059\u3079\u3066\u624b\u52d5\u3067\u4f5c\u6210\u3059\u308b\u306e\u306f\u9762\u5012\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001product\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u5165\u308c\u5b50\u30da\u30fc\u30b8\u30921\uff5e100\u307e\u3067\u7528\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f1.js\u30012.js\u3001\u3001\u3001100.js\u3068\u3044\u3046\u5177\u5408\u3067\u3059\u3002<\/p>\n<p>Next.js\u3067\u306fproduct\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306b\u7279\u6b8a\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3059\u308b\u3053\u3068\u3067\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u30d1\u30b9\u306b\u5fdc\u3058\u3066\u52d5\u7684\u306b\u30da\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u300c\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u300d\u3092\u5b9f\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>product\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306b\u3001<code>[productId].js<\/code>\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u30ab\u30c3\u30b3[]\u3067\u56f2\u3046\u3053\u3068\u3067\u3001\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">touch pages\/product\/[productId].js<\/code><\/pre>\n<p><strong>pages\/product\/[productId].js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">import {useRouter} from 'next\/router'\r\n\r\nfunction ProductDetail() {\r\n const router = useRouter()\r\n const productId = router.query.productId\r\n return &lt;h1&gt;Details about Product {productId}&lt;\/h1&gt;\r\n}\r\n\r\nexport default ProductDetail<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u4eca\u56de\u306f\u3001\u52d5\u7684\u306b\u30da\u30fc\u30b8\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u308f\u304b\u308a\u3084\u3059\u304f\u78ba\u8a8d\u3059\u308b\u305f\u3081\u3001useRouter\u30d5\u30c3\u30af\u3092\u7528\u3044\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u30da\u30fc\u30b8\u306e\u30d1\u30b9\uff08\u751f\u6210\u3055\u308c\u305f\u30da\u30fc\u30b8\u306e\u30d5\u30a1\u30a4\u30eb\u540d\uff09\u3092\u53d6\u5f97\u3057\u3066\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001JS\u30d5\u30a1\u30a4\u30eb\u30921\uff5e100\u307e\u3067\u624b\u52d5\u3067\u7528\u610f\u3059\u308b\u5fc5\u8981\u306f\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/nextjs4-4.png\" alt=\"\" width=\"685\" height=\"410\" class=\"alignnone size-full wp-image-1668 lazyload\" \/><\/p>\n<h2>\u305d\u306e\u2463\uff5cNext.js\u306e\u30cd\u30b9\u30c8\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<p><code>\u25cb\u25cb\u25cb.com\/product\/1\/review\/1<\/code>\u306e\u69d8\u306b\u52d5\u7684\u306b\u751f\u6210\u3055\u308c\u305f<code>product\/1<\/code>\u30da\u30fc\u30b8\u306b\u5bfe\u3057\u3001\u3055\u3089\u306b<code>review\/1<\/code>\u3068\u3044\u3046\u5165\u308c\u5b50\u69cb\u9020\u306e\u30da\u30fc\u30b8\u3092\u52d5\u7684\u306b\u751f\u6210\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u307e\u305a\u306f\u3001\u305d\u306e\u2462\u3067\u4f5c\u6210\u3057\u305fpages\/product\/[productId].js\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u7d9a\u3044\u3066pages\/Product\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u306b[productId]\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u7528\u610f\u3057\u3001\u305d\u306e\u4e2d\u306bindex.js\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u306f\u3001\u305d\u306e\u2462\u307e\u3067\u306e\u8868\u793a\u7d50\u679c\u3068\u5909\u308f\u308a\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">rm -r pages\/product\/[productId].js\r\nmkdir pages\/product\/[productId]\r\ntouch pages\/product\/[productId]\/index.js<\/code><\/pre>\n<p><strong>pages\/product\/[productId]\/index.js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">import {useRouter} from 'next\/router'\r\n\r\nfunction ProductDetail() {\r\n const router = useRouter()\r\n const productId = router.query.productId\r\n return &lt;h1&gt;Details about product {productId}&lt;\/h1&gt;\r\n}\r\n\r\nexport default productDetail<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u7d9a\u3044\u3066\u3001pages\/product\/[productId]\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u306breview\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u7528\u610f\u3057\u3001\u305d\u306e\u4e2d\u306b[reviewId].js\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">mkdir pages\/product\/[productId]\/review\r\ntouch pages\/product\/[productId]\/review\/[reviewId].js<\/code><\/pre>\n<p><strong>pages\/product\/[productId]\/review\/[reviewId].js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">import {useRouter} from 'next\/router'\r\n\r\nfunction Review() {\r\n const router = useRouter()\r\n const {productId, reviewId} = router.query\r\n \r\nreturn &lt;h1&gt;Review {reviewId} for product {productId}&lt;\/h1&gt;\r\n}\r\n\r\nexport default Review<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u3053\u308c\u3067\u3001\u4efb\u610f\u306eproduct\u30da\u30fc\u30b8\u306b\u5bfe\u3059\u308breview\u30da\u30fc\u30b8\u3092\u52d5\u7684\u306b\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/nextjs4-5.png\" alt=\"\" width=\"684\" height=\"376\" class=\"alignnone size-full wp-image-1669 lazyload\" \/><\/p>\n<h2>\u305d\u306e\u2464\uff5c\u3059\u3079\u3066\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u30ad\u30e3\u30c3\u30c1\u3059\u308b<\/h2>\n<p>\u3055\u3066\u3001\u6700\u5f8c\u306b\u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u964d\u306e\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\uff08\u3042\u308b\u3044\u306fURL\u30d1\u30b9\uff09\u3092\u30ad\u30e3\u30c3\u30c1\u3057\u3066\u5229\u7528\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3067\u306f\u30011\u3064\u76ee\u306e\u56fa\u5b9a\u3055\u308c\u305f\u30d1\u30b9\uff08product\uff09\u306b\u7d9a\u304f\u7121\u6570\u306e\u30d1\u30b9\uff08\/1\u3001\/2.....\/100\uff09\u306b\u5bfe\u3057\u3066\u81ea\u52d5\u3067\u30da\u30fc\u30b8\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3053\u306e\u65b9\u6cd5\u3067\u306f\u30011\u3064\u76ee\u306e\u30d1\u30b9\u3082\u7121\u6570\u306b\u9078\u629e\u80a2\u304c\u3042\u308b\u5834\u5408\u3001\u3044\u304f\u3064\u3082[example]\u30d5\u30a9\u30eb\u30c0\u3068\u305d\u306e\u4e2d\u306eindex.js\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u4e0d\u4fbf\u3067\u3059\u3002\u307e\u305f\u3001\u30d1\u30b9\u304c3\u30644\u30645\u3064\u3068\u7d9a\u304f\u5834\u5408\u3001\u4f55\u5c64\u306b\u3082[example]\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>Next.js\u3067\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u5148\u982d\u306b3\u3064\u306e\u30c9\u30c3\u30c8\uff08...\uff09\u3092\u3064\u3051\u3066\u30ab\u30c3\u30b3\uff08[]\uff09\u3067\u56f2\u3080\u3053\u3068\u3067\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u964d\u306e\u30cd\u30b9\u30c8\u3055\u308c\u305f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\uff08\u3042\u308b\u3044\u306fURL\u30d1\u30b9\uff09\u3092\u30ad\u30e3\u30c3\u30c1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001[...example].js\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff08\u30d1\u30b9\uff09\u4ee5\u964d\u306e\u30d1\u30b9\u304c\u7121\u6570\u3067\u3042\u3063\u3066\u3082\u3001\u305d\u308c\u3089\u306b\u5bfe\u3057\u81ea\u52d5\u3067\u30da\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u5b9f\u969b\u306b\u3084\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u307e\u305a\u306fpages\u30d5\u30a9\u30eb\u30c0\u76f4\u4e0b\u306bdocs\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u7528\u610f\u3057\u3001\u305d\u306e\u4e2d\u306b[[..params]].js\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Terminal<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-other\">mkdir pages\/docs\r\ntouch pages\/docs\/[[...params]].js<\/code><\/pre>\n<p><strong>[[...params]].js<\/strong><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">import {useRouter} from 'next\/router'\r\n\r\nfunction Doc() {\r\n const router = useRouter()\r\n const {params = []} = router.query\r\n    \r\n return (\r\n  &lt;&gt;\r\n   &lt;h1&gt;Docs Page&lt;\/h1&gt;\r\n   &lt;ul&gt;\r\n    {params.map((x, id) =&gt; {\r\n     return &lt;li key={id}&gt;{x}&lt;\/li&gt;\r\n    })}\r\n   &lt;\/ul&gt;\r\n  &lt;\/&gt;\r\n );\r\n}\r\n\r\nexport default Doc<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u3053\u3053\u3067\u3001\u4f8b\u3048\u3070localhost:3000\/docs\/brother\/sister\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3068\u3001docs\u4ee5\u964d\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u30ad\u30e3\u30c3\u30c1\u3055\u308c\u3066\u300cbrother\u300d\u3068\u300csister\u300d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/nextjs4-3.png\" alt=\"\" width=\"653\" height=\"366\" class=\"alignnone size-full wp-image-1667 lazyload\" \/><\/p>\n<p>\/docs\u4ee5\u964d\u306e\u30d1\u30b9\u306b\u3001\u3069\u306e\u3088\u3046\u306a\u30d1\u30b9\u3092\u3044\u304f\u3064\u6307\u5b9a\u3057\u3066\u3082\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u306b\u30da\u30fc\u30b8\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/image1-1.png\" alt=\"\" width=\"575\" height=\"340\" class=\"alignnone size-full wp-image-1707 lazyload\" \/><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u540d\u3092[[...example]]\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u305d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u964d\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u30ad\u30e3\u30c3\u30c1\u3057\u3066\u597d\u304d\u306a\u3088\u3046\u306b\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30d5\u30ec\u30ad\u30b7\u30d6\u30eb\u306a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u5b9f\u73fe\u3060\u3051\u3067\u306a\u304f\u3001URL\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u3082\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4ee5\u4e0a\u3067Next.js\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u6a5f\u80fd\u306e\u7d39\u4ecb\u306f\u7d42\u308f\u308a\u3067\u3059\u3002<\/p>\n<p>pages\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fb\u30d5\u30a1\u30a4\u30eb\u69cb\u6210\u304c\u305d\u306e\u307e\u307e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u5bfe\u5fdc\u3057\u3066\u304f\u308c\u308b\u70b9\u306f\u3001React\u306e\u8907\u96d1\u306a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\uff08react-router-dom\uff09\u306b\u6bd4\u3079\u308b\u3068\u5b09\u3057\u3044\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6b21\u56de\u306fNext.js\u306e\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\uff01<\/p>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/teno-hira.com\/media\/?p=1681\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"360\" height=\"360\" alt=\"Next.js\u3092\u5c11\u3057\u305a\u3064\u7406\u89e3\u3057\u3066\u3044\u304f5\u3010\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3011\" loading=\"lazy\" data-src=\"https:\/\/teno-hira.com\/media\/wp-content\/uploads\/2022\/09\/undraw_next_js_8g5m-360x360.png\" class=\"lazyload\"><\/div><div class=\"title\">Next.js\u3092\u5c11\u3057\u305a\u3064\u7406\u89e3\u3057\u3066\u3044\u304f5\u3010\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3011<\/div><div class=\"date\">2022.9.6<\/div><div class=\"substr\">\u4eca\u56de\u306fNext.js\u306e\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u6a5f\u80fd\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002\u201dNext.js\u306e\u201d\u3068\u3044\u3063\u305f\u3082\u306e\u306e\u3001\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u6a5f\u80fd\u306e\u5b9f\u73fe\u306b\u306flink\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u7528\u3044\u308b\u306e\u3067\u4f7f\u3044\u65b9\u306fReact\u3068\u540c\u3058\u3067\u3059\u3002 Next.js\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b \uff08\u74b0\u5883\u69cb\u7bc9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u4eba\u306f\u6b21\u7ae0\u300c\u305d\u306e\u2460\u300d\u306b\u9032\u3093\u3067\u304f\u3060\u3055\u3044\uff09 Next.js\u306e...<\/div><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306fNext.js\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u6a5f\u80fd\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002Next.js\u306fpages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d5\u30a1\u30a4\u30eb\u30fb\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u304c\u305d\u306e\u307e\u307e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u57fa\u672c\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u30cd\u30b9\u30c8\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3001\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30eb\u30fc\u30c6\u30a3\u2026<\/p>\n","protected":false},"author":15,"featured_media":1675,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[90],"tags":[],"class_list":["post-1662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cat-nextjs"],"_links":{"self":[{"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/posts\/1662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1662"}],"version-history":[{"count":12,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/posts\/1662\/revisions"}],"predecessor-version":[{"id":1708,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/posts\/1662\/revisions\/1708"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=\/wp\/v2\/media\/1675"}],"wp:attachment":[{"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/teno-hira.com\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}