Accepted answer

Do something like this:

let userId = {}

<Link to={`/users/${userId}/locations`} className="nav-link">Locations</Link>

Note: those are backticks, not single quotations. If you don't want to use ES6, you can do something like the following:

var userId = {}

<Link to={ "/users/" + userId + "/locations" } className="nav-link">Locations</Link>


Below should work:

<Link to={`/users/${}/locations`} className="nav-link">Locations</Link>

Related Query

More Query from same tag