{"id":2394,"date":"2022-12-24T19:56:26","date_gmt":"2022-12-24T10:56:26","guid":{"rendered":"https:\/\/www.agile-software.site\/?p=2394"},"modified":"2022-12-24T19:56:27","modified_gmt":"2022-12-24T10:56:27","slug":"usepathname","status":"publish","type":"post","link":"https:\/\/agile-software.net\/?p=2394","title":{"rendered":"<code>usePathname<\/code>"},"content":{"rendered":"\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>&#39;use client&#39;;\n\nimport { usePathname } from &#39;next\/navigation&#39;;\n\nexport default function Page() {\n  \/\/ When URL is \/blog\/hello, pathname = &#39;\/blog\/hello&#39;\n  \/\/ When URL is \/dashboard?v=2, pathname = &#39;\/dashboard&#39;\n  const pathname = usePathname();\n  return &lt;div&gt;{pathname}&lt;\/div&gt;;\n}<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2394","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/2394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2394"}],"version-history":[{"count":1,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/2394\/revisions"}],"predecessor-version":[{"id":2395,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/2394\/revisions\/2395"}],"wp:attachment":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}