Home > Web Front-end > JS Tutorial > How to jump out of a new page in react

How to jump out of a new page in react

coldplay.xixi
Release: 2023-01-04 09:38:07
Original
5386 people have browsed it

React method to jump out of a new page: 1. Jump to the new page unchanged from the local page, the code is [const w=window.open('about:blank')]; 2. Click the local page on the page Open a new page, the code is [Back to login page].

How to jump out of a new page in react

The operating environment of this tutorial: windows7 system, React17 version, DELL G3 computer.

Recommended: react video tutorial

How to jump out of a new page in react:

##1. The local page does not change and jumps to the new page

<Button style={{backgroundColor:&#39;#F0F2F5&#39;}} 
onClick={this.handle}
className="last-button"
>
handle=()=>{
  const w=window.open(&#39;about:blank&#39;);
  w.location.href="www.baidu.com"
}
Copy after login

2. Click the local page to open a new page

Introducing the ant Button component

<Button style={{backgroundColor:&#39;#F0F2F5&#39;}} 
  onClick={()=>{window.location.href="https://baidu.com"}}
  className="r-button"
>
Copy after login

Introduction

import {Link} from 'react-router-dom'

<Link to="/new/login/">
<Button className="e-button" type="primary">Back to login page</Button>
</Link>
Copy after login

Related free learning recommendations: javascript Video tutorial

The above is the detailed content of How to jump out of a new page in react. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template