Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
How to interpolate anchor tag in a text in React?

I have a variable

const linkElement = `Hey this is a link ${<a href="www.google.com">Click me!</a>} that can be clicked}`

This renders as Hey this is a link [Object object] that can be clicked.

How can I render this like, Hey this is a link Click me!(on click goes to google.com) that can be clicked

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

you would need to wrap your text inside a react component. A React component cannot be part of a string as it has no concept of a react component.

example:

LinkElement = () => <span>
  Hey this is a link <a href="www.google.com">Click me!</a> that can be clicked
<span>

//and the place you want to use it
<LinkElement />
about 4 years ago · Juan Pablo Isaza Report

0

You can do something like this

const linkElement = <>Hey this is a link<a href="www.google.com">Click me !</a> that can be clicked</>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!