📌  相关文章
📜  如何知道 React 类组件中的当前路由 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:57.995000             🧑  作者: Mango

代码示例2
/*For class based components*/
import { withRouter } from 'react-router-dom';

class SomeComponent extends Component {
  render() {
    console.log(this.props.location)
    console.log(this.props.location.pathname)
    console.log(this.props.location.match)
    return 
Something
} } export default withRouter(SomeComponent)