Home > Mobile >  How to use params to react router dom link
How to use params to react router dom link

Time:05-08

I got a problem when try to passing id to react router dom link

  <Link to="properties/${property.id}/edit">Edit</Link>

im sure the "property.id" is defined, but instead of going to the id of the pages, the link show like this:

http://localhost:3000/admin/properties/${property.id}/edit

can someone help me with this problem?

CodePudding user response:

You are passing a string to the to param. You should be passing a template string like this:-

<Link to={`/properties/${property.id}/edit/`}>Edit</Link>
  • Related