When pressing the icon i want my application to navigate me to localhost:8080/editrevision+700 (700 being the id of that specific item)
<Menu.Item className="edit"
as={Link}
to="/editrevision" + {revisionItem.id}>
<i className="far fa-edit"/>
</Menu.Item>
i keep getting syntax error on this, all suggestions are very appreciated.
The problem is the syntax of the to
. You should wrap the whole value in curly braces.
The best way to pass id a parameter is as /editrevision/700
. And, when you set the route, set its path as /editrevision/:id
. The id can be retrieved through this.props.match.params.id
.
<Menu.Item className="edit"
as={Link}
to={"/editrevision" + revisionItem.id}
>
<i className="far fa-edit"/>
</Menu.Item>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.