How to chechk is home with useRouter in Next.js(React)
Llike this👇
{router.pathname !== '/' && (
<div className=''>
...
</div>
)}
Properties of router
Here is a example that shows what are propeties of router
. This url is /search?q=aaa
, not /
so that we can understand. So don't use asPath
as this contains query, use pathname
or route
.
Today there is no defference between pathname
and route
.
Author And Source
この問題について(How to chechk is home with useRouter in Next.js(React)), 我々は、より多くの情報をここで見つけました https://zenn.dev/maztak/articles/0a59c556ce4b83著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Collection and Share based on the CC protocol