Answers for "next js redirect to an another web page on browser refresh"

0

how to redirect programatically in nextjs

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 March-23-2022
1

link in next js is refresh page

<Link href="/shop/[pid]" as={`/shop/${id}`}>
	<a>Shop by menu</a>
</Link>
Posted by: Guest on December-09-2020

Code answers related to "next js redirect to an another web page on browser refresh"

Browse Popular Code Answers by Language