“History.push in NextJS” Kod odpowiedzi

History.push in NextJS

import { useRouter } from 'next/router'

export default function Page() {
  const router = useRouter()

  return (
    <button type="button" onClick={() => router.push('/about')}>
      Click me
    </button>
  )
}
SabDev

Następny stan push router

import { withRouter } from 'next/router'

class About extends React.Component {
  // your Component implementation
  // retrieve them like this
  // this.props.router.query.name
}

export default withRouter(About)
Grumpy Goldfinch

Odpowiedzi podobne do “History.push in NextJS”

Pytania podobne do “History.push in NextJS”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu