Answers for "next js navigation to other page in a function"

0

next js navigation to other page in a function

import { useRouter } from 'next/router'

function Home() {
  const router = useRouter()


  const handleClick = e => {
    e.preventDefault()
    router.push('/some-path')
  }

  return (
    <button type="button" onClick={handleClick}>
      Go Somewhere
    </button>
  )
}
Posted by: Guest on September-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language