🛣️
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
.
Discussion