P
P
Pogran2016-08-30 16:59:26
React
Pogran, 2016-08-30 16:59:26

How to get params router in componentWillMount?

I have router
in EntityPage in componentWillMount function tried to get parameter like this

componentWillMount() {
    console.log(this.params.entity_id);

but this.params doesn't come there. how to get this.params?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2016-08-30
@Pogran

The router should have:

...
<Route path='/signin/:название_параметра' component={Компонент} />
...

in a component inside componentWillMount call this. props .params.parameter_name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question