import {Router} from 'react-router'import createBrowserHistory from 'history/createBrowserHistory'const history = createBrowserHistory();const store = rehydrate();const renderApp = Component => { render( <Router history={history}> <App/> </Router>, document.getElementById("root") );};这样写不是会直接注入history吗?我在App里面用this.props.hist6ory.push()就报错!要从context里面取吗?
1 回答
侃侃尔雅
TA贡献1801条经验 获得超16个赞
import {withRouter} from 'react-router'
import {inject, observer} from "mobx-react";
@inject("store")
@withRouter
加个注解
添加回答
举报
0/150
提交
取消