Answers for "react router dom push hook"

1

usehistory

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

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

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

  return (
    <button type="button" onClick={handleClick}>
      Go home
    </button>
  );
}
Posted by: Guest on November-23-2020

Code answers related to "react router dom push hook"

Code answers related to "Javascript"

Browse Popular Code Answers by Language