Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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;
Comment

PREVIOUS NEXT
Code Example
Javascript :: use filereader javascript 
Javascript :: react router path array 
Javascript :: stdout javascript 
Javascript :: usehistory() hook 
Javascript :: flutter response to json 
Javascript :: javascript good practice 
Javascript :: get downloadable link to s3 bucket object js 
Javascript :: how to make a progress bar in react 
Javascript :: get max height from array element jqeury 
Javascript :: how to check if a key is present in a dictionary in js 
Javascript :: why navlink in react router always active 
Javascript :: parsedate javascript 
Javascript :: how to print something in javascript 
Javascript :: javascript string() function 
Javascript :: jsonb_set 
Javascript :: fibonacci numbers 
Javascript :: queryselectors select element whole class 
Javascript :: show modal by using id in list react 
Javascript :: last element of array 
Javascript :: ordenar un array de mayor a menor 
Javascript :: ckeditor inline editor example 
Javascript :: how to give custom name to collection in mongoose 
Javascript :: how to append data to a form data in javascript 
Javascript :: searc and replace fcc solution 
Javascript :: javascript array destructuring last element 
Javascript :: get url from string javascript 
Javascript :: delete message plugin discord 
Javascript :: Children in JSX 
Javascript :: infinite loop in javascript 
Javascript :: generate qr code react 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =