I have this URL and a component that renders here. I want to get 'id' from here: localhost:8080/restaurants/2/feedback. How to get value of id '2' in feedback controller that is gonna be rendered? Here is how it is written in code link
<Route path="/restaurants/:id/feedback" component={Feedback} />
EDITED:
async componentDidMount() {
const { id } = this.props.params.id;
const data = await Api.getAllRestaurantFeedback('feedback?restaurantId=', id);
...
...
Feedback.propTypes = {
id: PropTypes.string.isRequired,
};
I have a warning here: ESLint: 'params.id.id' is missing in props validation(react/prop-types)