I am trying to create a list of users and have an inline text link to each user’s Facebook page. I need this link to be created dynamically from a database where the URL is saved as facebook.com/userpage.
This information is being saved from a form, so I’d prefer the user to not have to enter "http://www" when inputting the data.
Is it possible to use an href to do this? Something like this (which obviously does not work):
<a href="http://www.{user.facebook}">FB profile</a>
>Solution :
Assuming you are using react router,
<Link to={"http://www.facebook.com/"+ user.facebook} target="_blank" rel="noopener noreferrer" />
Since React Router version 5.0.1, you can use