📜  反应获取当前路线 - Javascript代码示例

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

代码示例3
/*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)