react-router跳转传值

Posted add+

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了react-router跳转传值相关的知识,希望对你有一定的参考价值。

跳转页面传递参数

1.引入包 
import {hashHistory} from ‘React-router’

2.跳转传值

    handleClick = (value) => {
        hashHistory.push({
            pathname: ‘message/detailMessage‘,
            query: {
                title:value.title,
                time:value.time,
                text:value.text
            },
        })
    }

3.接收值

console.info(this.props.location.query.title)
console.info(this.props.location.query.time)
console.info(this.props.location.query.text)

 

转载自:http://blog.csdn.net/sweiqin/article/details/60776603

以上是关于react-router跳转传值的主要内容,如果未能解决你的问题,请参考以下文章