How to click to jump to a new page in react: 1. Click on the local page to open a new page and introduce the ant Button component; 2. The local page will jump to the new page unchanged.
The operating environment of this tutorial: windows7 system, React17 version. This method is suitable for all brands of computers.
Related learning recommendations: react video tutorial
How to click to jump to a new page in react:
(1) Click the local page to open a new page
Introduce ant's Button component
<Button style={{backgroundColor:'#F0F2F5'}} onClick={()=>{window.location.href="https://baidu.com"}} className="r-button" >
Introduceimport {Link} from 'react-router-dom '
<Link to="/new/login/"> <Button className="e-button" type="primary">Back to login page</Button> </Link>
(2). Jump to the new page without changing the local page
<Button style={{backgroundColor:'#F0F2F5'}} onClick={this.handle} className="last-button" > handle=()=>{ const w=window.open('about:blank'); w.location.href="www.baidu.com" }
Related learning recommendations: javascript video Tutorial
The above is the detailed content of How to click to jump in react. For more information, please follow other related articles on the PHP Chinese website!