Answers for "in react how to redirect on another page on specific div"

1

function that redirects to another page react

const navigate = useNavigate();
const goToLoginPage = () => navigate('/login');
Posted by: Guest on October-09-2021
0

how to redirect to another page in react js on button click

import React from "react";
// importing Link from react-router-dom to navigate to 
// different end points.
import { Link } from "react-router-dom";
  
const Home = () => {
  return (
    <div>
      <h1>Home Page</h1>
      <br />
      <ul>
        <li>
          {/* Endpoint to route to Home component */}
          <Link to="/">Home</Link>
        </li>
        <li>
          {/* Endpoint to route to About component */}
          <Link to="/about">About</Link>
        </li>
        <li>
          {/* Endpoint to route to Contact Us component */}
          <Link to="/contactus">Contact Us</Link>
        </li>
      </ul>
    </div>
  );
};
  
export default Home;
Posted by: Guest on February-05-2022

Code answers related to "in react how to redirect on another page on specific div"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language