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 :: react private routes 
Javascript :: React Gotchas 
Javascript :: site:stackoverflow.com how to see all react dependencies 
Javascript :: close popup after 5 seconds in jquery 
Javascript :: How to Check if an Item is in an Array in JavaScript Using Array.includes() Starting From a Specified Index 
Javascript :: run javascript after rendering 
Javascript :: array of objects javascript 
Javascript :: react native componentdidmount in function 
Javascript :: responsive navbar react 
Javascript :: ng-options angularjs 
Javascript :: timezone using javascript 
Javascript :: js 
Javascript :: javascript promise example 
Javascript :: append javascript variable to html 
Javascript :: call bind apply in javascript 
Javascript :: array.map method 
Javascript :: calculate jwt expire time 
Javascript :: color switcher 
Javascript :: insertmany 
Javascript :: javascript handle updation of copy object 
Javascript :: truthy or falsy 
Javascript :: javascript Passing undefined Value 
Javascript :: javascript Duplicating a parameter name is not allowed 
Javascript :: actionscript round roundnumber 
Javascript :: how to divide a month into weeks in moment js 
Javascript :: javasrcipt jpg resize 
Javascript :: phaser grid align 
Javascript :: phaser animation random delay 
Javascript :: remove text and keep div inside a div jquery 2 
Javascript :: filter text js 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =