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

How to jump out of a new page in react

coldplay.xixi
coldplay.xixiOriginal
2020-12-25 11:17:205319browse

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"
}

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"
>

Introduction

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

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

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!

Statement:
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