score:7

Accepted answer

Do something like this:

let userId = {user.id}

<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 = {user.id}

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

score:0

Below should work:

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

Related Query

More Query from same tag