Difference between <Link to> and <Button onClick> React JS

Viewed 105

I am building a React JS app and was wondering what is the difference between returning:

<Link to={"/path"}><button>text</button></Link>

and setting

const history = useHistory();

const handleClick = () => {
  history.push("/path");
}

to return

<button onClick={handleClick}>text</button>

Cheers

0 Answers
Related