const { location } = this.props
console.log('location :',location )
发现location 为undefined
解决:
(1)组件包裹在中
(2)组件中引用 withRouter
import { withRouter } from 'react-router-dom'
@withRouter
class MyComponentxxx extends Component {...
const { location } = this.props
console.log('location :',location )
发现location 为undefined
解决:
(1)组件包裹在中
(2)组件中引用 withRouter
import { withRouter } from 'react-router-dom'
@withRouter
class MyComponentxxx extends Component {...