{"id":89,"date":"2026-06-26T13:32:24","date_gmt":"2026-06-26T13:32:24","guid":{"rendered":"https:\/\/aabbee.cafe24.com\/?p=89"},"modified":"2026-06-26T13:32:24","modified_gmt":"2026-06-26T13:32:24","slug":"nav","status":"publish","type":"post","link":"https:\/\/coalacoding.com\/?p=89","title":{"rendered":"Nav"},"content":{"rendered":"<h1>03. Nav.jsx \u2014 \ub124\ube44\uac8c\uc774\uc158 \ubc14<\/h1>\n<h2>\uc774\ubc88 \ub2e8\uacc4\uc5d0\uc11c \ud560 \uc77c<\/h2>\n<p>\uc0c1\ub2e8 \ub124\ube44\uac8c\uc774\uc158 \ubc14\ub97c \ub9cc\ub4ed\ub2c8\ub2e4.<br \/>\n\ud074\ub9ad\ud55c \uba54\ub274\uac00 \ud68c\uc0c9 pill \ubc30\uacbd\uc73c\ub85c \ubc14\ub00c\ub294 \uae30\ub2a5\ub3c4 \uad6c\ud604\ud569\ub2c8\ub2e4.<\/p>\n<hr>\n<h2>\ud53c\uadf8\ub9c8 \ub514\uc790\uc778 \ubd84\uc11d<\/h2>\n<pre><code>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  [\ub85c\uace0]      \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2510                            \u2502\n\u2502             \u2502 Home \u2502  AboutMe   Projects         \u2502  \ub192\uc774: 99px\n\u2502              \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518                            \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th>\uc694\uc18c<\/th>\n<th>\uac12<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\uc804\uccb4 \ub192\uc774<\/td>\n<td>99px<\/td>\n<\/tr>\n<tr>\n<td>\ubc30\uacbd\uc0c9<\/td>\n<td>#ffffff<\/td>\n<\/tr>\n<tr>\n<td>\ud65c\uc131 \uba54\ub274 \ubc30\uacbd<\/td>\n<td>#f5f5f5, \ub465\uadfc pill \ubaa8\uc591<\/td>\n<\/tr>\n<tr>\n<td>\ud14d\uc2a4\ud2b8 \uc0c9<\/td>\n<td>#1e1e1e<\/td>\n<\/tr>\n<tr>\n<td>\ud3f0\ud2b8 \ud06c\uae30<\/td>\n<td>16px<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr>\n<h2>\uc0c8\ub85c\uc6b4 \uac1c\ub150: <code>NavLink<\/code><\/h2>\n<p>React Router\uc758 <code>NavLink<\/code>\ub294 <code>&lt;a&gt;<\/code> \ud0dc\uadf8\ucc98\ub7fc \ub9c1\ud06c\ub97c \ub9cc\ub4e4\uc9c0\ub9cc,<br \/>\n<strong>\ud604\uc7ac URL\uacfc \uc77c\uce58\ud558\uba74 \uc790\ub3d9\uc73c\ub85c active \uc0c1\ud0dc\ub97c \uc54c\ub824\uc90d\ub2c8\ub2e4.<\/strong><\/p>\n<pre><code class=\"language-jsx\">import { NavLink } from &#39;react-router&#39;\n\n&lt;NavLink\n  to=&quot;#home&quot;\n  className={({ isActive }) =&gt;\n    `nav-item ${isActive ? &#39;nav-item--active&#39; : &#39;&#39;}`\n  }\n&gt;\n  Home\n&lt;\/NavLink&gt;\n<\/code><\/pre>\n<ul>\n<li><code>to<\/code> \u2192 \uc774\ub3d9\ud560 \uacbd\ub85c (<code>href<\/code> \ub300\uc2e0 <code>to<\/code> \ub97c \uc501\ub2c8\ub2e4)<\/li>\n<li><code>className<\/code> \u2192 \ud568\uc218\ub97c \uc804\ub2ec\ud558\uba74 <code>{ isActive }<\/code> \ub97c \ubc1b\uc544 \ub3d9\uc801 \ud074\ub798\uc2a4 \uc124\uc815 \uac00\ub2a5<\/li>\n<li><code>isActive<\/code> \u2192 \ud604\uc7ac URL\uc774 <code>to<\/code> \uc640 \uc77c\uce58\ud558\uba74 <code>true<\/code>, \uc544\ub2c8\uba74 <code>false<\/code><\/li>\n<\/ul>\n<hr>\n<h2>STEP 1 \u2014 Nav.jsx \uc791\uc131<\/h2>\n<pre><code class=\"language-jsx\">\/\/ src\/components\/Nav.jsx\nimport { NavLink } from &#39;react-router&#39;\n\nconst Nav = () =&gt; {\n  \/\/ \uba54\ub274 \ud56d\ubaa9: \ud654\uba74\uc5d0 \ubcf4\uc77c \uc774\ub984\uacfc \uc774\ub3d9\ud560 \ud574\uc2dc\ub97c \ud568\uaed8 \uad00\ub9ac\n  const links = [\n    { label: &#39;Home&#39;,     hash: &#39;#home&#39; },\n    { label: &#39;AboutMe&#39;,  hash: &#39;#aboutme&#39; },\n    { label: &#39;Projects&#39;, hash: &#39;#projects&#39; },\n  ]\n\n  return (\n    &lt;nav className=&quot;nav&quot;&gt;\n\n      {\/* \ub85c\uace0 \uc601\uc5ed *\/}\n      &lt;div className=&quot;nav-logo&quot;&gt;\n        &lt;svg width=&quot;30&quot; height=&quot;37&quot; viewBox=&quot;0 0 30 37&quot; fill=&quot;none&quot;&gt;\n          &lt;path d=&quot;M0 0 L10 37 L20 0 Z&quot; fill=&quot;#000&quot; \/&gt;\n          &lt;path d=&quot;M10 0 L30 37 L20 0 Z&quot; fill=&quot;#000&quot; \/&gt;\n        &lt;\/svg&gt;\n      &lt;\/div&gt;\n\n      {\/* \uba54\ub274 \ubaa9\ub85d *\/}\n      &lt;ul className=&quot;nav-list&quot;&gt;\n        {links.map(({ label, hash }) =&gt; (\n          &lt;li key={label}&gt;\n            &lt;NavLink\n              to={hash}\n              className={({ isActive }) =&gt;\n                `nav-item ${isActive ? &#39;nav-item--active&#39; : &#39;&#39;}`\n              }\n            &gt;\n              {label}\n            &lt;\/NavLink&gt;\n          &lt;\/li&gt;\n        ))}\n      &lt;\/ul&gt;\n\n    &lt;\/nav&gt;\n  )\n}\n\nexport default Nav\n<\/code><\/pre>\n<hr>\n<h2>\ucf54\ub4dc \uc124\uba85<\/h2>\n<h3>\uac1d\uccb4 \ubc30\uc5f4 + \uad6c\uc870 \ubd84\ud574 <code>{ label, hash }<\/code><\/h3>\n<pre><code class=\"language-jsx\">const links = [\n  { label: &#39;Home&#39;,     hash: &#39;#home&#39; },\n  { label: &#39;AboutMe&#39;,  hash: &#39;#aboutme&#39; },\n  { label: &#39;Projects&#39;, hash: &#39;#projects&#39; },\n]\n\n{links.map(({ label, hash }) =&gt; (\n  &lt;li key={label}&gt;...&lt;\/li&gt;\n))}\n<\/code><\/pre>\n<p>\ubc30\uc5f4 \uc694\uc18c\uac00 <strong>\uac1d\uccb4<\/strong>\uc774\ubbc0\ub85c <code>{ label, hash }<\/code> \ub85c \uad6c\uc870 \ubd84\ud574\ud558\uc5ec<br \/>\n<code>label<\/code>(\ud654\uba74\uc5d0 \ubcf4\uc77c \ud14d\uc2a4\ud2b8)\uacfc <code>hash<\/code>(\uc774\ub3d9\ud560 \uc704\uce58)\ub97c \uaebc\ub0c5\ub2c8\ub2e4.<\/p>\n<blockquote>\n<p><strong><code>key={label}<\/code> \uc740 \uc65c \ud544\uc694\ud55c\uac00\uc694?<\/strong><br \/>\nReact\uac00 \ubaa9\ub85d\uc5d0\uc11c \uac01 \ud56d\ubaa9\uc744 \uad6c\ubcc4\ud558\uae30 \uc704\ud574 \ud544\uc694\ud569\ub2c8\ub2e4.<br \/>\n\uc5c6\uc73c\uba74 \uacbd\uace0\uac00 \ub098\uc635\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n<h3><code>NavLink<\/code> \u2014 \ud65c\uc131 \uba54\ub274 \uc790\ub3d9 \uac10\uc9c0<\/h3>\n<pre><code class=\"language-jsx\">&lt;NavLink\n  to={hash}\n  className={({ isActive }) =&gt;\n    `nav-item ${isActive ? &#39;nav-item--active&#39; : &#39;&#39;}`\n  }\n&gt;\n  {label}\n&lt;\/NavLink&gt;\n<\/code><\/pre>\n<ul>\n<li><code>to={hash}<\/code> \u2192 \uc774\ub3d9\ud560 URL (\uc608: <code>#home<\/code>)<\/li>\n<li><code>className<\/code> \uc5d0 <strong>\ud568\uc218<\/strong>\ub97c \uc804\ub2ec\ud558\uba74 React Router\uac00 <code>{ isActive }<\/code> \ub97c \uc790\ub3d9\uc73c\ub85c \ub123\uc5b4\uc90d\ub2c8\ub2e4<\/li>\n<li><code>isActive<\/code> \uac00 <code>true<\/code> \uba74 <code>&#39;nav-item--active&#39;<\/code> \ud074\ub798\uc2a4 \ucd94\uac00<\/li>\n<\/ul>\n<p>\uc608\uc2dc:<\/p>\n<pre><code>\ud604\uc7ac URL: #home\n  Home     \u2192 isActive = true  \u2192 className=&quot;nav-item nav-item--active&quot;\n  AboutMe  \u2192 isActive = false \u2192 className=&quot;nav-item &quot;\n  Projects \u2192 isActive = false \u2192 className=&quot;nav-item &quot;\n<\/code><\/pre>\n<h3>\uc870\uac74\ubd80 \ud45c\ud604\uc2dd<\/h3>\n<pre><code class=\"language-jsx\">`nav-item ${isActive ? &#39;nav-item--active&#39; : &#39;&#39;}`\n<\/code><\/pre>\n<ul>\n<li><code>`\ubc31\ud2f1`<\/code> \uc548\uc5d0\uc11c <code>${}<\/code> \ub85c JavaScript \ud45c\ud604\uc2dd\uc744 \uc501\ub2c8\ub2e4<\/li>\n<li><code>isActive ? A : B<\/code> \u2192 <code>isActive<\/code> \uac00 <code>true<\/code> \uba74 A, <code>false<\/code> \uba74 \ube48 \ubb38\uc790\uc5f4<\/li>\n<\/ul>\n<hr>\n<h2>STEP 2 \u2014 CSS \ucd94\uac00<\/h2>\n<p><code>src\/index.css<\/code> \ud558\ub2e8\uc5d0 \ucd94\uac00\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-css\">\/* src\/index.css \uc5d0 \ucd94\uac00 *\/\n\n\/* \u2500\u2500 \ub124\ube44\uac8c\uc774\uc158 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 *\/\n\n.nav {\n  \/* \ub85c\uace0\uc640 \uba54\ub274\ub97c \uc88c\uc6b0\ub85c \ubc30\uce58 *\/\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n\n  height: 99px;\n  padding: 0 24px;\n  background-color: #ffffff;\n  border-bottom: 1px solid #f0f0f0;\n}\n\n\/* \uba54\ub274 \ubaa9\ub85d: \uac00\ub85c\ub85c \ub098\uc5f4 *\/\n.nav-list {\n  display: flex;\n  gap: 8px;          \/* \uba54\ub274 \uac04\uaca9 *\/\n}\n\n\/* \uba54\ub274 \ud56d\ubaa9 \uae30\ubcf8 \uc2a4\ud0c0\uc77c *\/\n.nav-item {\n  display: inline-block;\n  padding: 8px 16px;\n  border-radius: 100px; \/* pill \ubaa8\uc591 (\uc644\uc804\ud788 \ub465\uae00\uac8c) *\/\n  font-size: 16px;\n  color: #1e1e1e;\n  transition: background-color 0.2s; \/* \ubc30\uacbd\uc0c9\uc774 \ubd80\ub4dc\ub7fd\uac8c \ubcc0\ud568 *\/\n}\n\n\/* \ub9c8\uc6b0\uc2a4 \uc62c\ub9ac\uba74 \ubc30\uacbd \ud45c\uc2dc *\/\n.nav-item:hover {\n  background-color: #f5f5f5;\n}\n\n\/* \uc120\ud0dd\ub41c \uba54\ub274 *\/\n.nav-item--active {\n  background-color: #f5f5f5;\n}\n<\/code><\/pre>\n<hr>\n<h2>\ube0c\ub77c\uc6b0\uc800 \ud655\uc778<\/h2>\n<p>\uc800\uc7a5 \ud6c4 \ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c:<\/p>\n<ol>\n<li>\uc0c1\ub2e8\uc5d0 \ub85c\uace0\uc640 \uba54\ub274 3\uac1c\uac00 \ubcf4\uc785\ub2c8\ub2e4<\/li>\n<li>\ud604\uc7ac URL \uc704\uce58\uc5d0 \ub530\ub77c \uba54\ub274\uc5d0 \ud68c\uc0c9 \ubc30\uacbd\uc774 \uc0dd\uae41\ub2c8\ub2e4<\/li>\n<li>\uba54\ub274 \ud074\ub9ad \u2192 \ud574\ub2f9 \uc139\uc158\uc73c\ub85c \uc2a4\ud06c\ub864\ub429\ub2c8\ub2e4<\/li>\n<\/ol>\n<hr>\n<h2>\uc815\ub9ac<\/h2>\n<table>\n<thead>\n<tr>\n<th>\uac1c\ub150<\/th>\n<th>\uc0ac\uc6a9 \ubaa9\uc801<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>NavLink<\/code><\/td>\n<td>\ud604\uc7ac URL\uacfc \uc77c\uce58\ud558\ub294 \ub9c1\ud06c\uc5d0 active \uc0c1\ud0dc \uc790\ub3d9 \uc801\uc6a9<\/td>\n<\/tr>\n<tr>\n<td><code>to<\/code><\/td>\n<td>\uc774\ub3d9\ud560 \uacbd\ub85c \uc9c0\uc815 (<code>href<\/code> \ub300\uc2e0 \uc0ac\uc6a9)<\/td>\n<\/tr>\n<tr>\n<td><code>isActive<\/code><\/td>\n<td>NavLink\uc758 \ud65c\uc131 \uc5ec\ubd80\ub97c className \ud568\uc218\ub85c \uc804\ub2ec<\/td>\n<\/tr>\n<tr>\n<td><code>map<\/code><\/td>\n<td>\uba54\ub274 \ubc30\uc5f4\uc744 <code>&lt;li&gt;<\/code> \ubaa9\ub85d\uc73c\ub85c \ubcc0\ud658<\/td>\n<\/tr>\n<tr>\n<td>\uad6c\uc870 \ubd84\ud574<\/td>\n<td><code>{ label, hash }<\/code> \ub85c \uac1d\uccb4\uc5d0\uc11c \ud544\uc694\ud55c \uac12\ub9cc \uaebc\ub0b4\uae30<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>03. Nav.jsx \u2014 \ub124\ube44\uac8c\uc774\uc158 \ubc14 \uc774\ubc88 \ub2e8\uacc4\uc5d0\uc11c \ud560 \uc77c \uc0c1\ub2e8 \ub124\ube44\uac8c\uc774\uc158 \ubc14\ub97c \ub9cc\ub4ed\ub2c8\ub2e4. \ud074\ub9ad\ud55c \uba54\ub274\uac00 \ud68c\uc0c9 pill \ubc30\uacbd\uc73c\ub85c \ubc14\ub00c\ub294 \uae30\ub2a5\ub3c4 \uad6c\ud604\ud569\ub2c8\ub2e4. \ud53c\uadf8\ub9c8 \ub514\uc790\uc778 \ubd84\uc11d \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502 [\ub85c\uace0] \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502 \u2502 \u2502 Home \u2502 AboutMe Projects \u2502 \ub192\uc774: 99px \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \uc694\uc18c \uac12 \uc804\uccb4 \ub192\uc774 99px \ubc30\uacbd\uc0c9 #ffffff \ud65c\uc131 \uba54\ub274 \ubc30\uacbd #f5f5f5, \ub465\uadfc pill &#8230; <a title=\"Nav\" class=\"read-more\" href=\"https:\/\/coalacoding.com\/?p=89\" aria-label=\"Nav\uc5d0 \ub300\ud574 \ub354 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uc138\uc694\">\ub354 \uc77d\uae30<\/a><\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-react-resume"],"_links":{"self":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=89"}],"version-history":[{"count":0,"href":"https:\/\/coalacoding.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions"}],"wp:attachment":[{"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coalacoding.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}