I have a navbar with links
render() {
return (
<Link to={"/test/1"} >Task 1 </Link>
<Link to={"/test/2"} >Task 2 </Link>
<Link to={"/test/3"} >Task 3 </Link>
<Link to={"/test/4"} >Task 4 </Link>
)
}
And i set the route to call the corresponding component with dynamic id
to display the contents based on the id
And my called Test component has the following code
render() {
return (
<div>
<div>
{this.props.id}
</div>
</div>
);
}
And i need to change the contents in my component based on the id
passed in the route without refreshing. But {this.props.id}
does not populates the value there. How can i solve this?