代碼如下:importReact,{Component}from'react';importReactDOMfrom'react-dom';import'./index.css';importregisterServiceWorkerfrom'./registerServiceWorker';import'./App.css';importHeaderfrom'./header';importMainfrom'./main';importFooterfrom'./footer';importLoginfrom'./login/index'import{HashRouterasRouter,Route,hashHistory,Switch}from'react-router';import{Provider}from'react-redux'importstorefrom'./store'constHome=()=>(Home)constChat=()=>()constLoginPage=()=>()classAppextendsComponent{render(){**this.props.history.push('/chat')**console.log(hashHistory)return()}}想通過render中執(zhí)行切換路由this.props.history.push('/chat')報錯:TypeError:Cannotreadproperty'push'ofundefined,不知道怎么辦了,求解答
初學react,router跳轉失敗的問題
繁星coding
2019-05-22 22:02:26