Using React Router withRouter

后端 未结 2 2041
忘掉有多难
忘掉有多难 2020-12-10 14:28

How do you get the routing context, location, params, etc, when using withRouter()?

import { withRouter } from \'react-router\';

const Some         


        
2条回答
  •  [愿得一人]
    2020-12-10 15:07

    Getting location etc. via withRouter was added in react-router version 2.7. Dan Abramov recommends upgrading to 3.0 to use withRouter. Before 2.7, it only provided a set of functions.

提交回复
热议问题