'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?



Solution 1:[1]

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>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yash