I am trying to get dynamic routes from the API. When URL has parameter I send them accross API request and fetch the type and according to that type I am rendering my view.
I want to get the whole param from URL. The URL can be any and have any number of params.
Example URL: http://localhost:3000/type/article
App.js
<Route path="/:view" component={LayoutPage} />
LayoutPage
componentDidMount() {
this.doLoadView(this.props.match.params);
}
doLoadView(url) {
this.setState({ url: url});
console.log(url, 'match.params.view');
this.props.actionLoad(url);
}
On match.params.view it's giving 'type'. I know because I defined /:view in app.js so the output is only first param. but I want complete param i.e. 'type/article'.