编程语言
首页 > 编程语言> > react中使用编程式导航报错: Detail.jsx:5 Uncaught TypeError: Cannot read properties of undefined

react中使用编程式导航报错: Detail.jsx:5 Uncaught TypeError: Cannot read properties of undefined

作者:互联网

Detail.jsx:5 Uncaught TypeError: Cannot read properties of undefined

 

原因是在未定义路由的组件中使用了编程式导航

解决方法:

import {withRouter} from 'react-router-dom'

class Detail extends Component {...

export default withRouter(Detail)

 

标签:TypeError,undefined,read,Detail,react,Cannot,报错,Uncaught,jsx
来源: https://www.cnblogs.com/yinghuo123/p/15911117.html