Inertia.js alternative of history.push from React.js

Viewed 1226

I know that in React.js if you want to click on a button that will trigger the changing of the location i can use this:

import { useHistory } from "react-router-dom";

function HomeButton() {
  let history = useHistory();

  function handleClick() {
    history.push("/home");
  }

  return (
    <button type="button" onClick={handleClick}>
      Go home
    </button>
  );
}

I'm looking for an alternative in Inertia.Js https://inertiajs.com/links, but unfortunately i found just this ex:

<InertiaLink href="/logout" method="post" as="button" type="button">Logout</InertiaLink>

Question: How to make an alternative like in react js (history.push("/home");)?

1 Answers
Related