Answers for "onclick button redirect to another website in react js"

6

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;
Posted by: Guest on December-16-2020
3

how to go to another page onclick in react

<Link to="/signup" className="btn btn-primary">Sign up</Link>
Posted by: Guest on August-14-2021

Code answers related to "onclick button redirect to another website in react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language