react获取url查询参数

继承自React.Component的
this.props.location.query对象下
有当前url的各种查询参数。
简单的例子:在控制台打印这个对象

import React from 'react';
class Hello extends React.Component{
    constructor(props) {
        super(props);
        console.log(this.props.location.query);
    }
    render() {
        return(<div>我是hello页面</div>);
    }
 
}
 
module.exports =  Hello;

  

posted @ 2017-02-27 16:56  小虫1  阅读(28080)  评论(0)    收藏  举报