react 路由跳转

import React, { Component } from 'react';

//引入hashHistory


import {hashHistory} from 'react-router'

class About extends Component{
    constructor(props){
        super(props)
    }
// 事件执行
    tap(){
        hashHistory.push('/other')
    }
    render(){
        return(
            <div>
                <h2>About</h2>
//点击触发事件
                <button onClick={this.tap.bind(this)}>跳转到other</button>
            </div>
        )
    }
}
export default About

猜你喜欢

转载自blog.csdn.net/qq_43141894/article/details/82431714