I have a URL structure like so http://localhost:3001/article?id=12345
and I want to route the article ID parameter into a React Component. My Route
is like this <Route path="/article?id=" component={ArticleDetail}/>
and at the moment I am just trying to get it to print out the value of the parameter in my component like so:
class ArticleDetail extends Component {
render() {
const {location} = this.props.location;
return (
<div>
<h2>Article Detail</h2>
<p>This will show the full Article detail</p>
<p>props: {location}</p>
</div>
);
}
}
export default ArticleDetail;
I'm not seeing the component rendered at all though. What is the Route
I need to get it to load the component so I can then strip out the parameter value?