onclick redirect to another page react js <Redirect /> not code example
Example: redirect onclick react
import React from 'react';
import { useHistory } from "react-router-dom";
function Home() {
const history = useHistory();
const handleRoute = () =>{
history.push("/about");
}
return (
<Button
onClick={handleRoute}>
About
</Button>
);
}
export default Home;