'How can I use Link with a component and dynamic endpoint

How can I use Link with a component and dynamic endpoint, Would I be better using Router for this particular use case and if so, how would I implement it?

{rentals.map((rental, id) => (
          <Link key={id} href={`/rentals/${rental.id}`}>
            <RentalCard rental={rental} />
          </Link>
        ))}


Solution 1:[1]

Wrap the RentalCard Component in an empty A tag like so;

{rentals.map((rental, id) => (
            <Link key={id} href={`/rentals/${rental.id}`}>
              <a>
                <RentalCard rental={rental} />
              </a>
            </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 SeanMarc