使用 React 阅读当前的完整 URL? [英] Read the current full URL with React?

查看:28
本文介绍了使用 React 阅读当前的完整 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 ReactJS 组件中获取完整 URL?

How do I get the full URL from within a ReactJS component?

我认为它应该类似于 this.props.location 但它是 undefined

I'm thinking it should be something like this.props.location but it is undefined

推荐答案

window.location.href 正是您要找的.

这篇关于使用 React 阅读当前的完整 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆