Answers for "react native router push"

6

react router dom push

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>
  );
}
Posted by: Guest on May-11-2020
0

react router dom push

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

const Hist = () => {
	let history = useHistory()	
  
    const handleClick = () => {
      history.push("/home")
    }
  
  return (
    <Button type="button" onClick={handleClick}>
      Go home
    </Button>
  );

}
Posted by: Guest on November-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language