我想通过访问props.location.query来获取URL查询参数,但查询结果是未定义的,如何获取?
URL例子 - http:/localhost:3000home?param1=tomato¶m2=potato。
//Try this way without any lib.
const query = new URLSearchParams(this.props.location.search);
const param1 = query.get('param1');
const param2 = query.get('param2');