Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to use params to react router dom link

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/$%7Bproperty.id%7D/edit

can someone help me with this problem?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading