How Next.js useRouter() handle the mapping variable?

 const router = useRouter();
  return (
    <>
      {Usercategory.map((user,index)=>{
        return <div className='user-li' key={index} onClick={()=>{router.push(user.link)}}>
                <li> 
                  {user.icon}
                </li>
                <li>
                  <span>{user.name}</span>
                  <span>{user.entry}</span>
                </li>
               </div>
      })}
    </>
  )
}

On above ,

onClick={()=>{router.push(user.link)}

Couldn't work ?

How can I finish this? Thanks



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation