0

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.

Arasto
  • 471
  • 6
  • 25

1 Answers1

3

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>
reisdev
  • 3,215
  • 2
  • 17
  • 38
  • and that solved my whole issue. Thank you very much for taking your time and solving this. – Arasto Apr 02 '19 at 13:07
  • @ArastoSahbaei, you're welcome! Added a little tip to help you up. As this solves your problem, feel free to mark it as solution. – reisdev Apr 02 '19 at 13:07