Answers for "Router.query"

3

router nextjs

import { useRouter } from 'next/router'

function ActiveLink({ children, href }) {
  const router = useRouter()

  const handleClick = (e) => {
    e.preventDefault()
    router.push(href)
  }

  return (
    <a href={href} onClick={handleClick} style={style}>
      {children}
    </a>
  )
}

export default ActiveLink
Posted by: Guest on November-16-2020
1

vue router url string

const resolved = this.$router.resolve({
  name: 'SomeRouteName',
  params: { id: item.id }
})
resolved.href // '/some-route-name/:id'
Posted by: Guest on June-30-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language