Reactjs 失败的上下文类型:上下文“router.push”在“withRouter(t)”中标记为必需,但其值为“undefined”`
模块react router和react router的版本均为4.2.2 . 以下是我的反应路线Reactjs 失败的上下文类型:上下文“router.push”在“withRouter(t)”中标记为必需,但其值为“undefined”`,reactjs,react-router,react-router-dom,Reactjs,React Router,React Router Dom,模块react router和react router的版本均为4.2.2 . 以下是我的反应路线 const history = syncHistoryWithStore(createBrowserHistory(), store); const HeaderWithRouter = withRouter(Header); ReactDOM.render( <Provider store = {store}> <R
const history = syncHistoryWithStore(createBrowserHistory(), store);
const HeaderWithRouter = withRouter(Header);
ReactDOM.render(
<Provider store = {store}>
<Router history = {history} >
<section>
<HeaderWithRouter/>
<Route from = '/' to = '/deals'/>
<Route exact path="/deals" component={DealList}/>
<Route path = "/deal" component={FormDeal}/>
<Route path = "/admin" component={Admin}/>
<Route path = "/mandate" component={Mandate}/>
<Footer/>
</section>
</Router>
</Provider>
,
document.getElementById('app'));
const history=syncHistoryWithStore(createBrowserHistory(),store);
const HeaderWithRouter=withRouter(标头);
ReactDOM.render(
,
document.getElementById('app');
不起作用的是
我也收到了这个警告-失败的上下文类型:上下文
路由器。push在
中被标记为需要,但其值是未定义的