使用withRouter()时如何获取路由上下文、位置、参数等?
import { withRouter } from 'react-router';
const SomeComponent = ({location, route, params}) => (
<h1>The current location is {location.pathname}</h1>
);
const ComposedWithRouter = withRouter(SomeComponent);
您可以使用 withRouter 获取该信息还是必须将这些内容显式传递到组件树中?