React-router: How to get route params from a component other then the Router component

Created on 3 Aug 2016  路  1Comment  路  Source: ReactTraining/react-router

Now, I get a question:
I want get params in a component, that component not a router component.
I write like this, but can not get param;

class TeWidgetTool extends Component {
     getParams() {
           console.log(this.context.router)
      }
}
TeWidgetTool.contextTypes = {
    router: React.PropTypes.object
 };

>All comments

See e.g. https://github.com/reactjs/react-router/issues/3697 and other closed issues

Was this page helpful?
0 / 5 - 0 ratings